-
Notifications
You must be signed in to change notification settings - Fork 44
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #490 from eve-git/14439
validate NR
- Loading branch information
Showing
4 changed files
with
91 additions
and
5 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains 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
This file contains 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
This file contains 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 |
---|---|---|
|
@@ -76,6 +76,56 @@ describe('CorrectNameRequest', () => { | |
await flushPromises() | ||
|
||
expect(wrapper.vm.isFormValid).toBe(true) | ||
expect(wrapper.vm.nameRequestNumber).toEqual('NR 1234567') | ||
}) | ||
|
||
it('verifies inputs when valid', async () => { | ||
const wrapper = wrapperFactory() | ||
|
||
// Verify Invalid before input | ||
expect(wrapper.vm.isFormValid).toBe(false) | ||
|
||
wrapper.vm.nameRequestNumber = 'NR 1234567' | ||
wrapper.vm.applicantPhone = '123 456 7890' | ||
wrapper.vm.applicantEmail = '[email protected]' | ||
|
||
await flushPromises() | ||
|
||
expect(wrapper.vm.isFormValid).toBe(true) | ||
expect(wrapper.vm.nameRequestNumber).toEqual('NR 1234567') | ||
}) | ||
|
||
it('verifies inputs when valid', async () => { | ||
const wrapper = wrapperFactory() | ||
|
||
// Verify Invalid before input | ||
expect(wrapper.vm.isFormValid).toBe(false) | ||
|
||
wrapper.vm.nameRequestNumber = '1234567' | ||
wrapper.vm.applicantPhone = '123 456 7890' | ||
wrapper.vm.applicantEmail = '[email protected]' | ||
|
||
await flushPromises() | ||
|
||
expect(wrapper.vm.isFormValid).toBe(true) | ||
expect(wrapper.vm.nameRequestNumber).toEqual('NR 1234567') | ||
}) | ||
|
||
// the spaces between 'NR' and the numbers are ignored | ||
it('verifies valid NR input', async () => { | ||
const wrapper = wrapperFactory() | ||
|
||
// Verify Invalid before input | ||
expect(wrapper.vm.isFormValid).toBe(false) | ||
|
||
wrapper.vm.nameRequestNumber = 'NR 1234567' | ||
wrapper.vm.applicantPhone = '123 456 7890' | ||
wrapper.vm.applicantEmail = '[email protected]' | ||
|
||
await flushPromises() | ||
|
||
expect(wrapper.vm.isFormValid).toBe(true) | ||
expect(wrapper.vm.nameRequestNumber).toEqual('NR 1234567') | ||
}) | ||
|
||
it('verifies invalid NR', async () => { | ||
|
@@ -92,6 +142,38 @@ describe('CorrectNameRequest', () => { | |
expect(wrapper.vm.isFormValid).toBe(false) | ||
}) | ||
|
||
// the leading or trailing spaces of a NR are invalid | ||
it('verifies invalid NR', async () => { | ||
const wrapper = wrapperFactory() | ||
|
||
// Verify Invalid before input | ||
expect(wrapper.vm.isFormValid).toBe(false) | ||
|
||
wrapper.vm.nameRequestNumber = ' NR 1234567' | ||
wrapper.vm.applicantPhone = '123 456 7890' | ||
wrapper.vm.applicantEmail = '[email protected]' | ||
|
||
await flushPromises() | ||
|
||
expect(wrapper.vm.isFormValid).toBe(false) | ||
}) | ||
|
||
// the leading or trailing spaces are invalid | ||
it('verifies invalid NR', async () => { | ||
const wrapper = wrapperFactory() | ||
|
||
// Verify Invalid before input | ||
expect(wrapper.vm.isFormValid).toBe(false) | ||
|
||
wrapper.vm.nameRequestNumber = 'NR 1234567 ' | ||
wrapper.vm.applicantPhone = '123 456 7890' | ||
wrapper.vm.applicantEmail = '[email protected]' | ||
|
||
await flushPromises() | ||
|
||
expect(wrapper.vm.isFormValid).toBe(false) | ||
}) | ||
|
||
it('verifies invalid email', async () => { | ||
const wrapper = wrapperFactory() | ||
|
||
|