Skip to content

Commit

Permalink
Fix tests ...
Browse files Browse the repository at this point in the history
  • Loading branch information
dschmidt committed Dec 20, 2022
1 parent 3177b8e commit 2f5001f
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,9 @@ describe('OcPageSize', () => {
it('emits change event when value is selected', () => {
const wrapper = shallowMount(PageSize, { props: defaultProps })
;(wrapper.findComponent<any>('[data-testid="oc-page-size-select"]').vm as any).$emit(
'input',
'update:modelValue',
500
)

expect(wrapper.emitted().change[0][0]).toEqual(500)
})

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,6 @@ export default {
release: '8.0.0',
components: { OcSelect },
props: {
/**
* All possible sizes that the user can pick from
Expand Down Expand Up @@ -69,6 +68,7 @@ export default {
default: () => uniqueId('oc-page-size-')
}
},
emits: ['change'],
methods: {
emitChange(value) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
</template>

<script lang="ts">
import keycode from 'keycode'
import * as keycode from 'keycode'
import { eventBus } from 'web-pkg/src/services/eventBus'
import { mapActions, mapState, mapMutations, mapGetters } from 'vuex'
import { defineComponent, PropType } from 'vue'
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import KeyboardActions from '../../../../src/components/FilesList/KeyboardActions.vue'
import { mockDeep } from 'jest-mock-extended'
import { mock } from 'jest-mock-extended'
import { Resource, SpaceResource } from 'web-client/src/helpers'
import { eventBus } from 'web-pkg'
import keycode from 'keycode'
Expand Down Expand Up @@ -146,15 +146,15 @@ describe('KeyboardActions', () => {

it('adds the clicked file to the current selection', () => {
const { wrapper, storeOptions } = getWrapper()
wrapper.vm.handleShiftClickAction(mockDeep<Resource>({ id: resourceId }))
wrapper.vm.handleShiftClickAction(mock<Resource>({ id: resourceId }))
expect(storeOptions.modules.Files.mutations.ADD_FILE_SELECTION).toHaveBeenCalled()
expect(storeOptions.modules.Files.mutations.SET_LATEST_SELECTED_FILE_ID).toHaveBeenCalled()
})
})
describe('ctrl + click action', () => {
it('toggles the file selection', () => {
const { wrapper, storeOptions } = getWrapper()
wrapper.vm.handleCtrlClickAction(mockDeep<Resource>())
wrapper.vm.handleCtrlClickAction(mock<Resource>())
expect(storeOptions.modules.Files.actions.toggleFileSelection).toHaveBeenCalled()
})
})
Expand All @@ -177,7 +177,7 @@ const getWrapper = ({ props = {}, latestSelectedId = undefined } = {}) => {
return {
storeOptions,
wrapper: mount(KeyboardActions, {
props: { paginatedResources: [], space: mockDeep<SpaceResource>(), ...props },
props: { paginatedResources: [], space: mock<SpaceResource>(), ...props },
global: {
plugins: [...defaultPlugins(), store]
}
Expand Down

0 comments on commit 2f5001f

Please sign in to comment.