@@ -17,41 +17,41 @@ 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
1919test ( "should return true if the input object contain the key value" , ( ) => {
20- expect ( contains ( { a : 1 , b : 2 , c : 3 , d : 4 } , "a" ) ) . toBe ( true ) ;
21- expect ( contains ( { a : 1 , b : 2 , c : 3 , d : 4 } , "f" ) ) . toBe ( false ) ;
20+ expect ( contains ( { a : 1 , b : 2 , c : 3 , d : 4 } , "a" ) ) . toBe ( true ) ;
21+ expect ( contains ( { a : 1 , b : 2 , c : 3 , d : 4 } , "f" ) ) . toBe ( false ) ;
2222} ) ;
2323
2424// Given an empty object
2525// When passed to contains
2626// Then it should return false
2727test ( "should return false if the object is empty" , ( ) => {
2828 let emptyObject = { } ;
29- expect ( contains ( emptyObject , "a" ) ) . toBe ( false ) ;
29+ expect ( contains ( emptyObject , "a" ) ) . toBe ( false ) ;
3030} ) ;
3131
3232// Given an object with properties
3333// When passed to contains with an existing property name
3434// Then it should return true
3535test ( "should return true if the input object contain existing key value" , ( ) => {
36- let infoObject = { name :"John" , age :"24" , city :"Glasgow" } ;
37- expect ( contains ( infoObject , "name" ) ) . toBe ( true ) ;
38- expect ( contains ( infoObject , "age" ) ) . toBe ( true ) ;
39- expect ( contains ( infoObject , "city" ) ) . toBe ( true ) ;
36+ let infoObject = { name : "John" , age : "24" , city : "Glasgow" } ;
37+ expect ( contains ( infoObject , "name" ) ) . toBe ( true ) ;
38+ expect ( contains ( infoObject , "age" ) ) . toBe ( true ) ;
39+ expect ( contains ( infoObject , "city" ) ) . toBe ( true ) ;
4040} ) ;
4141
4242// Given an object with properties
4343// When passed to contains with a non-existent property name
4444// Then it should return false
4545test ( "should return false if the input object do not have non existing key value" , ( ) => {
46- let goodsObject = { fruit :"Apple" , amount :"50" , origin :"Glasgow" } ;
47- expect ( contains ( goodsObject , "tree" ) ) . toBe ( false ) ;
48- expect ( contains ( goodsObject , "color" ) ) . toBe ( false ) ;
49- expect ( contains ( goodsObject , "country" ) ) . toBe ( false ) ;
46+ let goodsObject = { fruit : "Apple" , amount : "50" , origin : "Glasgow" } ;
47+ expect ( contains ( goodsObject , "tree" ) ) . toBe ( false ) ;
48+ expect ( contains ( goodsObject , "color" ) ) . toBe ( false ) ;
49+ expect ( contains ( goodsObject , "country" ) ) . toBe ( false ) ;
5050} ) ;
5151// Given invalid parameters like an array
5252// When passed to contains
5353// Then it should return false or throw an error
5454test ( "should return false if the input object do not have non existing key value" , ( ) => {
55- let mixObject = { a : 2 , b : "hello" , c : [ ] } ;
56- expect ( contains ( mixObject , "c" ) ) . toBe ( false ) ;
57- } ) ;
55+ let mixObject = { a : 2 , b : "hello" , c : [ ] } ;
56+ expect ( contains ( mixObject , "c" ) ) . toBe ( false ) ;
57+ } ) ;
0 commit comments