Skip to content

Commit c68ec3e

Browse files
committed
add more tests
1 parent 5dcae6a commit c68ec3e

1 file changed

Lines changed: 10 additions & 3 deletions

File tree

‎Sprint-2/implement/contains.test.js‎

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,7 @@ as the object doesn't contains a key of 'c'
1616
// Given a contains function
1717
// When passed an object and a property name
1818
// Then it should return true if the object contains the property, false otherwise
19-
test("contains an object returns true, or false otherwise", () => {
20-
expect(contains({a: 1, b: 2, c: 3}, "a")).toBe(true);
21-
});
19+
2220

2321
// Given an empty object
2422
// When passed to contains
@@ -30,11 +28,20 @@ test("contains on empty object returns false", () => {
3028
// Given an object with properties
3129
// When passed to contains with an existing property name
3230
// Then it should return true
31+
test("contains an object returns true, or false otherwise", () => {
32+
expect(contains({a: 1, b: 2, c: 3}, "a")).toBe(true);
33+
});
3334

3435
// Given an object with properties
3536
// When passed to contains with a non-existent property name
3637
// Then it should return false
38+
test("contains an object returns true, or false otherwise", () => {
39+
expect(contains({a: 1, b: 2, c: 3}, "d")).toBe(false);
40+
});
3741

3842
// Given invalid parameters like an array
3943
// When passed to contains
4044
// Then it should return false or throw an error
45+
test("contains an object returns true, or false otherwise", () => {
46+
expect(contains([1, 2, 3, 'a'], "a")).toBe(false);
47+
});

0 commit comments

Comments
 (0)