-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
533681f
commit 92ad87f
Showing
1 changed file
with
33 additions
and
0 deletions.
There are no files selected for viewing
33 changes: 33 additions & 0 deletions
33
packages/forms-web-app/__tests__/unit/validators/interested-parties/add-comments.test.js
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 |
---|---|---|
@@ -0,0 +1,33 @@ | ||
const { rules } = require('../../../../src/validators/interested-parties/add-comments'); | ||
|
||
describe('validators/interested-parties/email-address', () => { | ||
describe('rules', () => { | ||
it(`has a rule for the interested parties comments`, () => { | ||
const rule = rules()[0].builder.build(); | ||
expect(rule.fields).toEqual(['comments']); | ||
expect(rule.locations).toEqual(['body']); | ||
expect(rule.optional).toBeFalsy(); | ||
expect(rule.stack).toHaveLength(3); | ||
expect(rule.stack[0].message).toEqual('Enter your comments'); | ||
expect(rule.stack[2].validator.name).toEqual('isLength'); | ||
}); | ||
|
||
it(`has a rule for the interested parties comment confirmation`, () => { | ||
const rule = rules()[1].builder.build(); | ||
expect(rule.fields).toEqual(['comments-confirmation']); | ||
expect(rule.locations).toEqual(['body']); | ||
expect(rule.optional).toBeFalsy(); | ||
expect(rule.stack).toHaveLength(1); | ||
expect(rule.stack[0].message).toEqual( | ||
'Select that you have not included any sensitive information in your comments.' | ||
); | ||
expect(rule.stack[0].validator.name).toEqual('isEmpty'); | ||
}); | ||
|
||
it('should have an array containing rule', () => { | ||
expect(rules().length).toEqual(2); | ||
expect(rules()[0].builder.fields[0]).toEqual('comments'); | ||
expect(rules()[1].builder.fields[0]).toEqual('comments-confirmation'); | ||
}); | ||
}); | ||
}); |