Skip to content

Commit 2830956

Browse files
committed
completed the todo tests
1 parent dcafc3b commit 2830956

File tree

1 file changed

+16
-1
lines changed

1 file changed

+16
-1
lines changed

Sprint-2/implement/contains.test.js

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,16 +20,31 @@ 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("given an empty object, returns false", () => {
24+
expect(contains({}, "x")).toEqual(false);
25+
});
2426

2527
// Given an object with properties
2628
// When passed to contains with an existing property name
2729
// Then it should return true
30+
test("given an object with properties, returns true when passed to contains with an existing property name", () => {
31+
expect(
32+
contains({ gitName: "djebsoft", position: "cyf trainee" }, "gitName")
33+
).toEqual(true);
34+
});
2835

2936
// Given an object with properties
3037
// When passed to contains with a non-existent property name
3138
// Then it should return false
39+
test("given an object with properties, returns false when passed to contains with a non-existent property name", () => {
40+
expect(
41+
contains({ gitName: "djebsoft", position: "cyf trainee" }, "age")
42+
).toEqual(false);
43+
});
3244

3345
// Given invalid parameters like an array
3446
// When passed to contains
3547
// Then it should return false or throw an error
48+
test("given invalid parameters, returns false or throws an error", () => {
49+
expect(contains(["gitName", "position"], "gitName")).toEqual(false);
50+
});

0 commit comments

Comments
 (0)