-
-
Notifications
You must be signed in to change notification settings - Fork 166
Adds unit and e2e tests for CopyrightWaiverStep Component #152
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from 1 commit
Commits
Show all changes
10 commits
Select commit
Hold shift + click to select a range
99ba7a4
Adds unit tests for CopyrightWaiverStep Component
JackieBinya c2018c1
Remove repeated test
JackieBinya b2f774f
Clears minor bugs from review
JackieBinya 32aaeed
Clears linting errors in the file ComponentWaiverStep.spec.js
JackieBinya 43f6003
Adds more unit tests
JackieBinya 1027d9d
Adds more unit test
JackieBinya 0091078
Merge branch 'ft-copyright-unit' of github.com:JackieBinya/chooser in…
JackieBinya bf0d321
Refactored tests to improve coverage
JackieBinya 33961ce
Cleared linting problems
JackieBinya c384f38
Adds e2e tests
JackieBinya File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next
Next commit
Adds unit tests for CopyrightWaiverStep Component
- Loading branch information
commit 99ba7a49d9050d8ea1bb5c404de0fd4dd5ea8d51
There are no files selected for viewing
118 changes: 118 additions & 0 deletions
118
tests/unit/specs/components/CopyrightWaiverStep.spec.js
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,118 @@ | ||
import { createLocalVue, mount } from '@vue/test-utils' | ||
import Buefy from 'buefy' | ||
import Vuex from 'vuex' | ||
import CopyrightWaiverStep from '@/components/CopyrightWaiverStep' | ||
|
||
const localVue = createLocalVue() | ||
|
||
localVue.use(Vuex) | ||
localVue.use(Buefy) | ||
|
||
describe('CopyrightWaiver Step: Check conditional rendering of markup', () => { | ||
let wrapper, state | ||
|
||
beforeEach(() => { | ||
wrapper = mount(CopyrightWaiverStep, { | ||
localVue, | ||
data() { | ||
return { | ||
agreed: false, | ||
confirmed: false | ||
} | ||
}, | ||
mocks: { | ||
$t: key => key, | ||
} | ||
}) | ||
}) | ||
|
||
afterEach(()=> { | ||
wrapper.destroy() | ||
}) | ||
|
||
it('Component not mounted if status is inactive', () =>{ | ||
wrapper.setProps({ | ||
selected: undefined, | ||
status : 'inactive', | ||
stepId: 6, | ||
stepName: 'CW', | ||
}) | ||
|
||
expect(wrapper.find('.step-description').exists()).toBeFalsy | ||
obulat marked this conversation as resolved.
Show resolved
Hide resolved
|
||
expect(wrapper.find('.step-actions').exists()).toBeFalsy() | ||
}) | ||
|
||
it('Step Description block mounted if status is previous', () =>{ | ||
wrapper.setProps({status : 'previous'}) | ||
|
||
expect(wrapper.find('.step-description').exists()).toBeTruthy() | ||
expect(wrapper.find('.step-actions').exists()).toBeFalsy() | ||
}) | ||
|
||
it('Step Actions block mounted if status is current', () =>{ | ||
wrapper.setProps({status : 'current'}) | ||
|
||
expect(wrapper.find('.step-description').exists()).toBeFalsy() | ||
expect(wrapper.find('.step-actions').exists()).toBeTruthy() | ||
expect(wrapper.vm.copyrightWaiverAgreed).toBe(false) | ||
}) | ||
|
||
it('User clicks copyright waiver checkbox', () => { | ||
wrapper.setProps({status : 'current'}) | ||
|
||
const checkbox = wrapper.findAll('input[type="checkbox"]').at(0) | ||
checkbox.setChecked(); | ||
|
||
console.log(wrapper.emitted()) | ||
|
||
}) | ||
|
||
}) | ||
|
||
describe('Test functionality of computed properties', () => { | ||
let wrapper | ||
|
||
beforeEach(() => { | ||
wrapper = mount(CopyrightWaiverStep, { | ||
localVue, | ||
propsData:{ | ||
selected: undefined, | ||
status : 'current', | ||
stepId: 6, | ||
stepName: 'CW', | ||
}, | ||
mocks: { | ||
$t: key => key, | ||
} | ||
}) | ||
}) | ||
|
||
afterEach(()=> { | ||
wrapper.destroy() | ||
}) | ||
|
||
it('User checks agreed with confirmed checked', () => { | ||
wrapper.setData({ | ||
agreed: false, | ||
confirmed: true | ||
}) | ||
|
||
const checkbox = wrapper.findAll('input[type="checkbox"]').at(0) | ||
checkbox.setChecked(); | ||
|
||
expect(wrapper.emitted().change[0]).toStrictEqual(['CW', 6, true]) | ||
}) | ||
|
||
it('User checks confirmed with agreed checked', () => { | ||
wrapper.setData({ | ||
agreed: true, | ||
confirmed: false | ||
}) | ||
|
||
const checkbox = wrapper.findAll('input[type="checkbox"]').at(1) | ||
checkbox.setChecked(); | ||
|
||
expect(wrapper.emitted().change[0]).toStrictEqual(['CW', 6, true]) | ||
}) | ||
|
||
}) |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.