Skip to content

Commit

Permalink
address reviews
Browse files Browse the repository at this point in the history
  • Loading branch information
saw-jan committed Sep 15, 2021
1 parent fd36b3d commit 8ab03d7
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 16 deletions.
25 changes: 9 additions & 16 deletions packages/web-app-files/tests/unit/views/SharedViaLink.spec.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
import { shallowMount, mount } from '@vue/test-utils'
import flushPromises from 'flush-promises'
import { getStore, localVue, createFile } from './views.setup.js'
import MixinFilesListPagination from '@files/src/mixins/filesListPagination'
import FileActions from '@files/src/mixins/fileActions'
import MixinFilesListPositioning from '@files/src/mixins/filesListPositioning'
import SharedViaLink from '@files/src/views/SharedViaLink.vue'

const $route = {
Expand Down Expand Up @@ -48,17 +51,14 @@ const selectors = {

describe('SharedViaLink view', () => {
jest
.spyOn(SharedViaLink.mixins[3].methods, '$_filesListPagination_updateCurrentPage')
.spyOn(MixinFilesListPagination.methods, '$_filesListPagination_updateCurrentPage')
.mockImplementation()
const spyAdjustTableHeaderPosition = jest.spyOn(
SharedViaLink.mixins[1].methods,
MixinFilesListPositioning.methods,
'adjustTableHeaderPosition'
)
const spyShowDefaultPanel = jest
.spyOn(SharedViaLink.mixins[4].methods, '$_mountSideBar_showDefaultPanel')
.mockImplementation()
const spyTriggerDefaultAction = jest
.spyOn(SharedViaLink.mixins[0].methods, '$_fileActions_triggerDefaultAction')
.spyOn(FileActions.methods, '$_fileActions_triggerDefaultAction')
.mockImplementation()
const spyLoadResources = jest.spyOn(SharedViaLink.methods, 'loadResources')
const spyRowMounted = jest.spyOn(SharedViaLink.methods, 'rowMounted')
Expand All @@ -84,8 +84,10 @@ describe('SharedViaLink view', () => {
describe('when the view is still loading', () => {
it('should show list-loader component', () => {
const wrapper = getShallowWrapper()
const listLoader = wrapper.find(selectors.listLoader)

expect(wrapper.find(selectors.listLoader).exists()).toBeTruthy()
expect(listLoader.exists()).toBeTruthy()
expect(listLoader).toMatchSnapshot()
})
})

Expand Down Expand Up @@ -147,15 +149,6 @@ describe('SharedViaLink view', () => {
expect(listInfo.props().files).toEqual(activeFiles.length)
expect(listInfo.props().folders).toEqual(0)
})
it('should trigger showing the sidebar when a "showDetails" event gets emitted', () => {
const ocTableFiles = wrapper.find(selectors.ocTableFiles)

expect(spyShowDefaultPanel).toHaveBeenCalledTimes(0)

ocTableFiles.vm.$emit('showDetails')

expect(spyShowDefaultPanel).toHaveBeenCalledTimes(1)
})
it('should trigger the default action when a "fileClick" event gets emitted', () => {
const ocTableFiles = wrapper.find(selectors.ocTableFiles)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,3 +10,5 @@ exports[`SharedViaLink view when the view is not loading anymore when there are
<div class="oc-text-muted"></div>
</div>
`;

exports[`SharedViaLink view when the view is still loading should show list-loader component 1`] = `<list-loader-stub></list-loader-stub>`;

0 comments on commit 8ab03d7

Please sign in to comment.