@@ -20,16 +20,39 @@ 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 ( "contains on empty object returns false" , ( ) => {
24+ const inputEmpty = [ ] ;
25+ const result = contains ( inputEmpty ) ;
26+ expect ( result ) . toEqual ( false ) ;
27+ } ) ;
2428
2529// Given an object with properties
2630// When passed to contains with an existing property name
2731// Then it should return true
32+ test ( "Given an object with properties when pass to contains it returns true" , ( ) => {
33+ const myObject = {
34+ name : "Alice" ,
35+ age : 30 ,
36+ city : "London" ,
37+ } ;
38+ const result = contains ( myObject , "name" ) ;
39+ expect ( result ) . toEqual ( true ) ;
40+ } ) ;
2841
2942// Given an object with properties
3043// When passed to contains with a non-existent property name
3144// Then it should return false
45+ test ( "give a object with proprieties when pass contains with non-exist proprity name it should return false" , ( ) => {
46+ const inputProprieties2 = [ "f" , "g" , "h" ] ;
47+ const result = contains ( inputProprieties2 ) ;
48+ expect ( result ) . toEqual ( false ) ;
49+ } ) ;
3250
3351// Given invalid parameters like an array
3452// When passed to contains
3553// Then it should return false or throw an error
54+ test ( "invalid parameters should return false or throw an error" , ( ) => {
55+ const invalidParameters = ( "f" , "g" , "h" ) ;
56+ const result = contains ( invalidParameters ) ;
57+ expect ( result ) . toEqual ( false ) ;
58+ } ) ;
0 commit comments