Skip to content

Commit 4c218e9

Browse files
committed
Merge branch 'coursework/sprint-3-tdd' of https://github.com/zilinskyte/Module-Structuring-and-Testing-Data into coursework/sprint-3-tdd
2 parents 2a5b49d + 49acf7c commit 4c218e9

File tree

3 files changed

+9
-9
lines changed

3 files changed

+9
-9
lines changed

Sprint-3/2-practice-tdd/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,5 +9,5 @@ Write the tests _before_ the code that will make them pass.
99
Recommended order:
1010

1111
1. `count.test.js`
12-
1. `repeat.test.js`
12+
1. `repeat-str.test.js`
1313
1. `get-ordinal-number.test.js`
File renamed without changes.

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

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,25 @@
1-
// Implement a function repeat
2-
const repeat = require("./repeat");
31

2+
// Implement a function repeatStr
3+
const repeatStr = require("./repeat-str");
44
// Given a target string str and a positive integer count,
5-
// When the repeat function is called with these inputs,
5+
// When the repeatStr function is called with these inputs,
66
// Then it should:
77

88
// case: repeat String:
99
// Given a target string str and a positive integer count,
10-
// When the repeat function is called with these inputs,
10+
// When the repeatStr function is called with these inputs,
1111
// Then it should repeat the str count times and return a new string containing the repeated str values.
1212

1313
test("should repeat the string count times", () => {
1414
const str = "hello";
1515
const count = 3;
16-
const repeatedStr = repeat(str, count);
16+
const repeatedStr = repeatStr(str, count);
1717
expect(repeatedStr).toEqual("hellohellohello");
1818
});
1919

2020
// case: handle Count of 1:
2121
// Given a target string str and a count equal to 1,
22-
// When the repeat function is called with these inputs,
22+
// When the repeatStr function is called with these inputs,
2323
// Then it should return the original str without repetition, ensuring that a count of 1 results in no repetition.
2424
test("should return the original string when count is 1", () => {
2525
const str = "hello";
@@ -30,7 +30,7 @@ test("should return the original string when count is 1", () => {
3030

3131
// case: Handle Count of 0:
3232
// Given a target string str and a count equal to 0,
33-
// When the repeat function is called with these inputs,
33+
// When the repeatStr function is called with these inputs,
3434
// Then it should return an empty string, ensuring that a count of 0 results in an empty output.
3535
test("should return an empty string when count is 0", () => {
3636
const str = "hello";
@@ -41,7 +41,7 @@ test("should return an empty string when count is 0", () => {
4141

4242
// case: Negative Count:
4343
// Given a target string str and a negative integer count,
44-
// When the repeat function is called with these inputs,
44+
// When the repeatStr function is called with these inputs,
4545
// Then it should throw an error or return an appropriate error message, as negative counts are not valid.
4646
test("should throw an error for negative count", () => {
4747
const str = "hello";

0 commit comments

Comments
 (0)