Skip to content
Prev Previous commit
Next Next commit
Adds more unit test
  • Loading branch information
JackieBinya committed Apr 2, 2020
commit 1027d9d21e0c1ea54e7fc4a62ee32f8a1e782ec6
51 changes: 51 additions & 0 deletions tests/unit/specs/components/CopyrightWaiverStep.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,7 @@ describe('Test functionality of computed properties', () => {
checkbox.setChecked()

expect(wrapper.emitted().change[0]).toStrictEqual(['CW', 6, true])
expect(wrapper.vm.copyrightWaiverAgreed).toBe(true)
})

it('User checks confirmed with agreed checked', () => {
Expand All @@ -102,5 +103,55 @@ describe('Test functionality of computed properties', () => {
checkbox.setChecked()

expect(wrapper.emitted().change[0]).toStrictEqual(['CW', 6, true])
expect(wrapper.vm.copyrightWaiverConfirmed).toBe(true)
})
})

describe('Computed properties: user unchecks agreed and/ confirmed', () => {
let wrapper

beforeEach(() => {
wrapper = mount(CopyrightWaiverStep, {
localVue,
propsData: {
selected: true,
status: 'current',
stepId: 6,
stepName: 'CW'
},
mocks: {
$t: key => key
}
})
})

afterEach(() => {
wrapper.destroy()
})

it('User unchecks agreed', () => {
wrapper.setData({
agreed: true,
confirmed: true
})

const checkbox = wrapper.findAll('input[type="checkbox"]').at(0)
checkbox.trigger('change')

expect(wrapper.emitted().change[0]).toStrictEqual(['CW', 6, undefined])
expect(wrapper.vm.copyrightWaiverAgreed).toBe(false)
})

it('User unchecks confirmed', () => {
wrapper.setData({
agreed: true,
confirmed: true
})

const checkbox = wrapper.findAll('input[type="checkbox"]').at(1)
checkbox.trigger('change')

expect(wrapper.emitted().change[0]).toStrictEqual(['CW', 6, undefined])
expect(wrapper.vm.copyrightWaiverConfirmed).toBe(false)
})
})