Skip to content

Commit

Permalink
Fix unit tests
Browse files Browse the repository at this point in the history
  • Loading branch information
JanAckermann committed Jul 20, 2022
1 parent d949a60 commit c4dc8a9
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
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
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 c4dc8a9

Please sign in to comment.