mirror of
https://github.com/IT4Change/Ocelot-Social.git
synced 2025-12-13 07:45:56 +00:00
Sketch a component test for DisableModal
This commit is contained in:
parent
cdc9cd0af2
commit
61e6773e86
57
components/Modal/DisableModal.spec.js
Normal file
57
components/Modal/DisableModal.spec.js
Normal file
@ -0,0 +1,57 @@
|
||||
import { shallowMount, createLocalVue } from '@vue/test-utils'
|
||||
import DisableModal from './DisableModal.vue'
|
||||
import Vue from 'vue'
|
||||
import Styleguide from '@human-connection/styleguide'
|
||||
|
||||
|
||||
const localVue = createLocalVue()
|
||||
|
||||
localVue.use(Styleguide)
|
||||
|
||||
describe('DisableModal.vue', () => {
|
||||
let Wrapper
|
||||
let store
|
||||
let mocks
|
||||
|
||||
beforeEach(() => {
|
||||
mocks = {
|
||||
$t: () => {},
|
||||
$apollo: {
|
||||
mutate: jest.fn().mockResolvedValue(null)
|
||||
}
|
||||
}
|
||||
})
|
||||
|
||||
describe('shallowMount', () => {
|
||||
let wrapper
|
||||
const Wrapper = () => {
|
||||
return shallowMount(DisableModal, { mocks, localVue })
|
||||
}
|
||||
|
||||
describe('click cancel button', () => {
|
||||
beforeEach(async () => {
|
||||
wrapper = Wrapper()
|
||||
await wrapper.find('button.cancel').trigger('click')
|
||||
})
|
||||
|
||||
it('emits close', () => {
|
||||
expect(wrapper.emitted().close).toBeTruthy()
|
||||
})
|
||||
|
||||
it.todo('does not call mutation')
|
||||
})
|
||||
|
||||
describe('click confirm button', () => {
|
||||
beforeEach(async () => {
|
||||
wrapper = Wrapper()
|
||||
await wrapper.find('button.confirm').trigger('click')
|
||||
})
|
||||
|
||||
it('emits close', () => {
|
||||
expect(wrapper.emitted().close).toBeTruthy()
|
||||
})
|
||||
it.todo('calls disable mutation')
|
||||
it.todo('passes id to mutation')
|
||||
})
|
||||
})
|
||||
})
|
||||
Loading…
x
Reference in New Issue
Block a user