Skip to content

Commit

Permalink
update tests after component changes
Browse files Browse the repository at this point in the history
  • Loading branch information
saw-jan committed Oct 7, 2021
1 parent 740aa42 commit 9537850
Showing 1 changed file with 10 additions and 10 deletions.
20 changes: 10 additions & 10 deletions packages/web-app-files/tests/unit/views/SharedViaLink.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ const $route = {
}
}

const activeFiles = [createFile({ id: 1234, type: 'file' })]
const activeFilesCurrentPage = [createFile({ id: 1234, type: 'file' })]

localVue.prototype.$client.requests = {
ocs: jest.fn(() =>
Expand All @@ -24,7 +24,7 @@ localVue.prototype.$client.requests = {
json: jest.fn(() =>
Promise.resolve({
ocs: {
data: activeFiles
data: activeFilesCurrentPage
}
})
)
Expand Down Expand Up @@ -122,7 +122,7 @@ describe('SharedViaLink view', () => {
let wrapper
beforeEach(async () => {
stubs['oc-table-files'] = false
wrapper = getWrapper(activeFiles)
wrapper = getWrapper(activeFilesCurrentPage)
await flushPromises()
})

Expand All @@ -133,20 +133,20 @@ describe('SharedViaLink view', () => {
const ocTableFiles = wrapper.find(selectors.ocTableFiles)

expect(ocTableFiles.exists()).toBeTruthy()
expect(ocTableFiles.props().resources).toMatchObject(activeFiles)
expect(ocTableFiles.props().resources).toMatchObject(activeFilesCurrentPage)
expect(ocTableFiles.props().areThumbnailsDisplayed).toBe(false)
expect(ocTableFiles.props().headerPosition).toBe(0)
expect(ocTableFiles.props().targetRoute).toMatchObject({ name: 'files-personal' })
})
it('should set props on context-actions component', () => {
const contextActions = wrapper.find(selectors.contextActions)

expect(contextActions.props().item).toMatchObject(activeFiles[0])
expect(contextActions.props().item).toMatchObject(activeFilesCurrentPage[0])
})
it('should set props on list-info component', () => {
const listInfo = wrapper.find(selectors.listInfo)

expect(listInfo.props().files).toEqual(activeFiles.length)
expect(listInfo.props().files).toEqual(activeFilesCurrentPage.length)
expect(listInfo.props().folders).toEqual(0)
})
it('should trigger the default action when a "fileClick" event gets emitted', () => {
Expand All @@ -159,7 +159,7 @@ describe('SharedViaLink view', () => {
expect(spyTriggerDefaultAction).toHaveBeenCalledTimes(1)
})
it('should lazily load previews when a "rowMounted" event gets emitted', () => {
expect(spyRowMounted).toHaveBeenCalledTimes(activeFiles.length)
expect(spyRowMounted).toHaveBeenCalledTimes(activeFilesCurrentPage.length)
})
})
})
Expand All @@ -186,9 +186,9 @@ function getShallowWrapper(files = []) {
})
}

function createStore(activeFiles) {
function createStore(activeFilesCurrentPage) {
return getStore({
activeFiles,
totalFilesCount: { files: activeFiles.length, folders: 0 }
activeFilesCurrentPage,
totalFilesCount: { files: activeFilesCurrentPage.length, folders: 0 }
})
}

0 comments on commit 9537850

Please sign in to comment.