@@ -16,20 +16,54 @@ as the object doesn't contains a key of 'c'
16
16
// Given a contains function
17
17
// When passed an object and a property name
18
18
// Then it should return true if the object contains the property, false otherwise
19
+ describe ( "edge cases of the contains function" , ( ) => {
20
+ test ( "contains an object and property and returns true" , ( ) => {
21
+ const currentOutput = contains ( { property : "value" } , "property" ) ;
22
+ const targetOutput = true ;
23
+ expect ( currentOutput ) . toEqual ( targetOutput ) ;
24
+ } ) ;
25
+ } ) ;
19
26
20
27
// Given an empty object
21
28
// When passed to contains
22
29
// Then it should return false
23
- test . todo ( "contains on empty object returns false" ) ;
30
+ describe ( "edge cases of the contains function" , ( ) => {
31
+ test ( "contains on empty object returns false" , ( ) => {
32
+ const currentOutput = contains ( { } , "property" ) ;
33
+ const targetOutput = false ;
34
+ expect ( currentOutput ) . toEqual ( targetOutput ) ;
35
+ } ) ;
36
+ } ) ;
24
37
25
38
// Given an object with properties
26
39
// When passed to contains with an existing property name
27
40
// Then it should return true
41
+ describe ( "edge cases of the contains function" , ( ) => {
42
+ test ( "contains an object and property and returns true" , ( ) => {
43
+ const currentOutput = contains ( { property : "value" } , "property" ) ;
44
+ const targetOutput = true ;
45
+ expect ( currentOutput ) . toEqual ( targetOutput ) ;
46
+ } ) ;
47
+ } ) ;
28
48
29
49
// Given an object with properties
30
50
// When passed to contains with a non-existent property name
31
51
// Then it should return false
52
+ describe ( "edge cases of the contains function" , ( ) => {
53
+ test ( "contains an object and property and returns true" , ( ) => {
54
+ const currentOutput = contains ( { property : "value" } , "lava" ) ;
55
+ const targetOutput = false ;
56
+ expect ( currentOutput ) . toEqual ( targetOutput ) ;
57
+ } ) ;
58
+ } ) ;
32
59
33
60
// Given invalid parameters like an array
34
61
// When passed to contains
35
62
// Then it should return false or throw an error
63
+ describe ( "edge cases of the contains function" , ( ) => {
64
+ test ( "contains an object and property and returns true" , ( ) => {
65
+ const currentOutput = contains ( [ ] , "property" ) ;
66
+ const targetOutput = false ;
67
+ expect ( currentOutput ) . toEqual ( targetOutput ) ;
68
+ } ) ;
69
+ } ) ;
0 commit comments