File tree Expand file tree Collapse file tree 2 files changed +32
-5
lines changed
Expand file tree Collapse file tree 2 files changed +32
-5
lines changed Original file line number Diff line number Diff line change 1+ const valid = require ( '../../lib/validators/date' ) ;
2+
3+ const model = {
4+ date : true
5+ } ;
6+
7+ describe ( ' - Date validator' , ( ) => {
8+
9+ it ( 'shall be a function' , ( ) => {
10+ expect ( typeof valid ) . toEqual ( 'function' ) ;
11+ } ) ;
12+
13+ it ( 'shall return true with a valid date' , ( ) => {
14+ const date = new Date ( ) ;
15+ const result = valid ( date , model ) ;
16+ expect ( result ) . toEqual ( true ) ;
17+ } ) ;
18+
19+ it ( 'shall return true with a parsable date' , ( ) => {
20+ const date = 'Jan 9, 2018' ;
21+ const result = valid ( date , model ) ;
22+ expect ( result ) . toEqual ( true ) ;
23+ } ) ;
24+
25+ it ( 'shall return false with a non parsable date' , ( ) => {
26+ const date = 'NoDate' ;
27+ const result = valid ( date , model ) ;
28+ expect ( result ) . toEqual ( false ) ;
29+ } ) ;
30+
31+ } ) ;
Original file line number Diff line number Diff line change 11const valid = require ( '../../lib/validators/func' ) ;
22
3-
4-
5- describe ( ' - Function validator' , ( ) => {
6-
7-
3+ describe ( ' - Function validator' , ( ) => {
84 it ( 'shall be a function' , ( ) => {
95 expect ( typeof valid ) . toEqual ( 'function' ) ;
106 } ) ;
You can’t perform that action at this time.
0 commit comments