@@ -16,22 +16,29 @@ as the object doesn't contains a key of 'c'
1616// Given a contains function
1717// When passed an object and a property name
1818// Then it should return true if the object contains the property, false otherwise
19- test . todo ( "contains returns true for existing property" ) ;
20- test . todo ( "contains returns false for non-existent property" ) ;
19+ test ( "contains returns true for existing property" ) ;
20+ expect ( contains ( { a : 1 , b : 2 } , 'a' ) ) . toBe ( true ) ;
21+
22+ test ( "contains returns false for non-existent property" ) ;
23+ expect ( contains ( { a : 1 , b : 2 } , 'c' ) ) . toBe ( false ) ;
2124// Given an empty object
2225// When passed to contains
2326// Then it should return false
24- test . todo ( "contains on empty object returns false" ) ;
27+ test ( "contains returns false for empty object" ) ;
28+ expect ( contains ( { } , 'a' ) ) . toBe ( false ) ;
2529
2630// Given an object with properties
2731// When passed to contains with an existing property name
2832// Then it should return true
29- test . todo ( "contains returns true for existing property" ) ;
33+ test ( "contains returns true for existing property" ) ;
34+ expect ( contains ( { a : 1 , b : 2 } , 'a' ) ) . toBe ( true ) ;
3035// Given an object with properties
3136// When passed to contains with a non-existent property name
3237// Then it should return false
33- test . todo ( "contains returns false for non-existent property" ) ;
38+ test ( "contains returns false for non-existent property" ) ;
39+ expect ( contains ( { a : 1 , b : 2 } , 'c' ) ) . toBe ( false ) ;
3440// Given invalid parameters like an array
3541// When passed to contains
3642// Then it should return false or throw an error
37- test . todo ( "contains with invalid parameters returns false or throws error" ) ;
43+ test ( "contains with invalid parameters returns false or throws error" ) ;
44+ expect ( contains ( [ 1 , 2 , 3 ] , 'a' ) ) . toBe ( false ) ;
0 commit comments