@@ -67,28 +67,28 @@ describe("employees", () => {
67
67
68
68
it ( "should have valid data types for all fields" , ( ) => {
69
69
employees . forEach ( ( employee ) => {
70
- expect ( employee . username ) . to . be . a ( "string" ) . and . not . empty ;
71
- expect ( employee . password ) . to . be . a ( "string" ) . and . not . empty ;
72
- expect ( employee . name . first ) . to . be . a ( "string" ) . and . not . empty ;
73
- expect ( employee . name . last ) . to . be . a ( "string" ) . and . not . empty ;
70
+ expect ( employee . username ) . to . be . a ( "string" ) . with . length . of . at . least ( 1 ) ;
71
+ expect ( employee . password ) . to . be . a ( "string" ) . with . length . of . at . least ( 1 ) ;
72
+ expect ( employee . name . first ) . to . be . a ( "string" ) . with . length . of . at . least ( 1 ) ;
73
+ expect ( employee . name . last ) . to . be . a ( "string" ) . with . length . of . at . least ( 1 ) ;
74
74
expect ( employee . gender ) . to . be . a ( "string" ) . and . match ( / ^ m a l e | f e m a l e $ / ) ;
75
- expect ( employee . portrait ) . to . be . a ( "string" ) . and . not . empty ;
76
- expect ( employee . thumbnail ) . to . be . a ( "string" ) . and . not . empty ;
77
- expect ( employee . email ) . to . be . a ( "string" ) . and . not . empty ;
78
- expect ( employee . address . street ) . to . be . a ( "string" ) . and . not . empty ;
79
- expect ( employee . address . city ) . to . be . a ( "string" ) . and . not . empty ;
80
- expect ( employee . address . state ) . to . be . a ( "string" ) . and . not . empty ;
75
+ expect ( employee . portrait ) . to . be . a ( "string" ) . with . length . of . at . least ( 1 ) ;
76
+ expect ( employee . thumbnail ) . to . be . a ( "string" ) . with . length . of . at . least ( 1 ) ;
77
+ expect ( employee . email ) . to . be . a ( "string" ) . with . length . of . at . least ( 1 ) ;
78
+ expect ( employee . address . street ) . to . be . a ( "string" ) . with . length . of . at . least ( 1 ) ;
79
+ expect ( employee . address . city ) . to . be . a ( "string" ) . with . length . of . at . least ( 1 ) ;
80
+ expect ( employee . address . state ) . to . be . a ( "string" ) . with . length . of . at . least ( 1 ) ;
81
81
expect ( employee . address . zip ) . to . be . a ( "string" ) . and . match ( / ^ \d { 5 } $ / ) ;
82
82
expect ( employee . phones ) . to . be . an ( "array" ) . and . have . length . above ( 0 ) ;
83
83
expect ( employee . ssn ) . to . be . a ( "string" ) . and . match ( / ^ \d { 3 } - \d { 2 } - \d { 4 } $ / ) ;
84
84
expect ( employee . department ) . to . be . a ( "string" ) . and . match ( / ^ A c c o u n t i n g | S a l e s | H u m a n R e s o u r c e s | M a r k e t i n g $ / ) ;
85
85
expect ( employee . roles ) . to . be . an ( "array" ) . and . have . length . above ( 0 ) ;
86
86
87
87
if ( isJSON ) {
88
- expect ( employee . dob ) . to . be . a ( "string" ) . and . not . empty ;
89
- expect ( employee . hiredOn ) . to . be . a ( "string" ) . and . not . empty ;
88
+ expect ( employee . dob ) . to . be . a ( "string" ) . with . length . of . at . least ( 1 ) ;
89
+ expect ( employee . hiredOn ) . to . be . a ( "string" ) . with . length . of . at . least ( 1 ) ;
90
90
if ( employee . terminatedOn ) {
91
- expect ( employee . terminatedOn ) . to . be . a ( "string" ) . and . not . empty ;
91
+ expect ( employee . terminatedOn ) . to . be . a ( "string" ) . with . length . of . at . least ( 1 ) ;
92
92
}
93
93
}
94
94
else {
@@ -125,8 +125,8 @@ describe("employees", () => {
125
125
expect ( employee . thumbnail ) . to . satisfy ( path . isAbsolute ) ;
126
126
}
127
127
128
- expect ( fs . existsSync ( employee . portrait ) ) . to . be . true ;
129
- expect ( fs . existsSync ( employee . thumbnail ) ) . to . be . true ;
128
+ expect ( fs . existsSync ( employee . portrait ) ) . to . equal ( true ) ;
129
+ expect ( fs . existsSync ( employee . thumbnail ) ) . to . equal ( true ) ;
130
130
}
131
131
else {
132
132
expect ( employee . portrait ) . to . equal ( "portraits/" + employee . username + ".jpg" ) ;
0 commit comments