Skip to content

Commit 9eb9378

Browse files
committed
reinstate sprint 3 files
1 parent b3b4efb commit 9eb9378

2 files changed

Lines changed: 1 addition & 28 deletions

File tree

Sprint-3/2-practice-tdd/count.js

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,5 @@
11
function countChar(stringOfCharacters, findCharacter) {
2-
let count = 0;
3-
4-
for (const char of stringOfCharacters) {
5-
if (char === findCharacter) {
6-
count++;
7-
}
8-
}
9-
10-
return count;
2+
return 5;
113
}
124

135
module.exports = countChar;

Sprint-3/2-practice-tdd/count.test.js

Lines changed: 0 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -18,26 +18,7 @@ test("should count multiple occurrences of a character", () => {
1818
});
1919

2020
// Scenario: No Occurrences
21-
test("should return 0 when the character does not occur in the string", () => {
22-
// Given the input string `str`
23-
const str = "hello";
24-
const char = "z";
25-
const count = countChar(str, char);
26-
expect(count).toEqual(0);
27-
});
28-
29-
// // And a character `char` that does not exist in the string
30-
// const char = "z";
31-
32-
// // When the function is called with these inputs
33-
// const count = countChar(str, char);
34-
35-
// // Then it should return 0
36-
// expect(count).toEqual(0);
37-
// });
38-
3921
// Given the input string `str`,
40-
4122
// And a character `char` that does not exist within `str`.
4223
// When the function is called with these inputs,
4324
// Then it should return 0, indicating that no occurrences of `char` were found.

0 commit comments

Comments
 (0)