Skip to content

Commit

Permalink
Fix unit tests
Browse files Browse the repository at this point in the history
  • Loading branch information
AlexAndBear committed Jul 13, 2022
1 parent 7e41eb6 commit 2c40d14
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 6 deletions.
1 change: 0 additions & 1 deletion packages/web-app-files/src/search/sdk/preview.ts
Expand Up @@ -42,7 +42,6 @@ export default class Preview implements SearchPreview {
5, // todo: add configuration option, other places need that too... needs consolidation
DavProperties.Default
)

const resources = plainResources.results.reduce((acc, plainResource) => {
let resourceName = decodeURIComponent(plainResource.name)
if (resourceName.startsWith('/dav')) {
Expand Down
Expand Up @@ -107,7 +107,10 @@ function getWrapper(searchTerm = '', files = []) {
return mount(List, {
localVue,
propsData: {
searchResults: getSearchResults(files)
searchResults: {
range: undefined,
resources: getSearchResults(files)
}
},
store: createStore(files),
router: new VueRouter(),
Expand Down
8 changes: 4 additions & 4 deletions packages/web-app-files/tests/unit/search/sdk.spec.ts
Expand Up @@ -102,7 +102,7 @@ describe('SDKProvider', () => {
const noTerm = await search.previewSearch.search('')
expect(noTerm).toBeFalsy()

searchMock.mockReturnValueOnce(files)
searchMock.mockReturnValueOnce({ results: files })
const withTerm = await search.previewSearch.search('foo')
expect(withTerm.map((r) => r.data)).toMatchObject(files)

Expand All @@ -119,9 +119,9 @@ describe('SDKProvider', () => {
{ id: 'baz', name: 'baz' }
]

searchMock.mockReturnValueOnce(files)
const withTerm = await search.listSearch.search('foo')
expect(withTerm.map((r) => r.data)).toMatchObject(files)
searchMock.mockReturnValueOnce({ results: files })
const withTerm = (await search.listSearch.search('foo')) as any
expect(withTerm.resources.map((r) => r.data)).toMatchObject(files)
})
})
})

0 comments on commit 2c40d14

Please sign in to comment.