Skip to content

Commit 7f7884b

Browse files
committed
Add tests for empty values in length validator
1 parent 2b29174 commit 7f7884b

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

packages/react-form-renderer/src/tests/validators/validators.test.js

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,14 @@ describe('New validators', () => {
2828
});
2929

3030
describe('Length validator', () => {
31+
it('should pass empty value', () => {
32+
expect(validatorMapper(validators.EXACT_LENGTH)({ threshold: 5 })('')).toBeUndefined();
33+
});
34+
35+
it('should pass undefined value', () => {
36+
expect(validatorMapper(validators.EXACT_LENGTH)({ threshold: 5 })(undefined)).toBeUndefined();
37+
});
38+
3139
it('should pass exact length of 5 characters validation', () => {
3240
expect(validatorMapper(validators.EXACT_LENGTH)({ threshold: 5 })('12345')).toBeUndefined();
3341
});

0 commit comments

Comments
 (0)