@@ -17,19 +17,31 @@ as the object doesn't contains a key of 'c'
1717// When passed an object and a property name
1818// Then it should return true if the object contains the property, false otherwise
1919
20- // Given an empty object
21- // When passed to contains
22- // Then it should return false
23- test . todo ( "contains on empty object returns false" ) ;
24-
25- // Given an object with properties
26- // When passed to contains with an existing property name
27- // Then it should return true
28-
29- // Given an object with properties
30- // When passed to contains with a non-existent property name
31- // Then it should return false
32-
33- // Given invalid parameters like an array
34- // When passed to contains
35- // Then it should return false or throw an error
20+ // Given an empty object
21+ // When passed to contains
22+ // Then it should return false
23+ test ( "contains on empty object returns false" , ( ) => {
24+ expect ( contains ( { } , "a" ) ) . toBe ( false ) ;
25+ } ) ;
26+
27+ // Given an object with properties
28+ // When passed to contains with an existing property name
29+ // Then it should return true
30+ test ( "returns true when passed an existing property name" , ( ) => {
31+ const inputObj = { a : 1 , b : 2 } ;
32+ } ) ;
33+
34+ // Given an object with properties
35+ // When passed to contains with a non-existent property name
36+ // Then it should return false
37+ test ( "returns false when passed a non-existent property name" , ( ) => {
38+ const inputObj = { a : 1 , b : 2 } ;
39+ expect ( contains ( inputObj , "c" ) ) . toBe ( false ) ;
40+ } ) ;
41+
42+ // Given invalid parameters like an array
43+ // When passed to contains
44+ // Then it should return false or throw an error
45+ test ( "returns false when passed invalid parameters like arrays or primitives" , ( ) => {
46+ expect ( contains ( [ 1 , 2 , 3 ] , "0" ) ) . toBe ( false ) ;
47+ } ) ;
0 commit comments