Skip to content

Commit 8222fda

Browse files
committed
Changed order of tests in repeat-str.test.js so
that the test for 0 comes first.
1 parent 5fb5bbf commit 8222fda

File tree

1 file changed

+24
-12
lines changed

1 file changed

+24
-12
lines changed

Sprint-3/2-practice-tdd/repeat-str.test.js

Lines changed: 24 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,30 @@ const repeatStr = require("./repeat-str");
44
// When the repeatStr function is called with these inputs,
55
// Then it should:
66

7+
// Case: Handle count of 0:
8+
// Given a target string `str` and a `count` equal to 0,
9+
// When the repeatStr function is called with these inputs,
10+
// Then it should return an empty string.
11+
12+
test("should return empty string on count of 0", () => {
13+
const str = "hello";
14+
const count = 0;
15+
const repeatedStr = repeatStr(str, count);
16+
expect(repeatedStr).toEqual("");
17+
});
18+
19+
// Case: Handle count of 0:
20+
// Given a target string `str` and a `count` equal to 0,
21+
// When the repeatStr function is called with these inputs,
22+
// Then it should return an empty string.
23+
24+
test("should return empty string on count of 0", () => {
25+
const str = "hello";
26+
const count = 0;
27+
const repeatedStr = repeatStr(str, count);
28+
expect(repeatedStr).toEqual("");
29+
});
30+
731
// Case: handle multiple repetitions:
832
// Given a target string `str` and a positive integer `count` greater than 1,
933
// When the repeatStr function is called with these inputs,
@@ -28,18 +52,6 @@ test("should return the original string when count is 1", () => {
2852
expect(repeatedStr).toEqual("hello");
2953
});
3054

31-
// Case: Handle count of 0:
32-
// Given a target string `str` and a `count` equal to 0,
33-
// When the repeatStr function is called with these inputs,
34-
// Then it should return an empty string.
35-
36-
test("should return empty string on count of 0", () => {
37-
const str = "hello";
38-
const count = 0;
39-
const repeatedStr = repeatStr(str, count);
40-
expect(repeatedStr).toEqual("");
41-
});
42-
4355
// Case: Handle negative count:
4456
// Given a target string `str` and a negative integer `count`,
4557
// When the repeatStr function is called with these inputs,

0 commit comments

Comments
 (0)