@@ -20,16 +20,37 @@ as the object doesn't contains a key of 'c'
2020// Given an empty object
2121// When passed to contains
2222// Then it should return false
23- test . todo ( "contains on empty object returns false" ) ;
23+ //test.todo("contains on empty object returns false");
24+ test ( "given an empty object, it should return false" , ( ) => {
25+ const currentOutput = contains ( { } ) ;
26+ const targetOutput = false ;
27+ expect ( currentOutput ) . toEqual ( targetOutput ) ;
28+ } ) ;
2429
2530// Given an object with properties
2631// When passed to contains with an existing property name
2732// Then it should return true
33+ test ( "given an object with properties, when passed to contains with an existing property name it should return true" , ( ) => {
34+ const currentOutput = contains ( { a : 1 , b : 2 } , 'a' ) ;
35+ const targetOutput = true ;
36+ expect ( currentOutput ) . toEqual ( targetOutput ) ;
37+ } ) ;
38+
2839
2940// Given an object with properties
3041// When passed to contains with a non-existent property name
3142// Then it should return false
43+ test ( "given an object with properties, when passed to contains with a non-existent property name it should return false" , ( ) => {
44+ const currentOutput = contains ( { a : 1 , b : 2 } , 'c' ) ;
45+ const targetOutput = false ;
46+ expect ( currentOutput ) . toEqual ( targetOutput ) ;
47+ } ) ;
3248
3349// Given invalid parameters like an array
3450// When passed to contains
3551// Then it should return false or throw an error
52+ test ( "given ivalid parameters like an array, when passed to contains it should return false throw an error" , ( ) => {
53+ const currentOutput = contains ( [ 1 , 'a' ] , 'c' ) ;
54+ const targetOutput = false ;
55+ expect ( currentOutput ) . toEqual ( targetOutput ) ;
56+ } ) ;
0 commit comments