Skip to content

Commit 39d99a4

Browse files
committed
Add test for MUI form fields helpers
1 parent a686a0e commit 39d99a4

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
import { validationError } from '../form-fields/helpers';
2+
3+
describe('form fields helpers', () => {
4+
describe('validationError', () => {
5+
it('returns meta.error when validateOnMount', () => {
6+
expect(validationError({ error: 'error' }, true)).toEqual('error');
7+
});
8+
9+
it('returns meta.error || meta.touched when validateOnMount', () => {
10+
expect(validationError({ error: 'error', touched: false }, false)).toEqual(false);
11+
expect(validationError({ error: 'error', touched: true }, false)).toEqual('error');
12+
});
13+
});
14+
});

0 commit comments

Comments
 (0)