Skip to content

Commit 16bb366

Browse files
author
cjyuan
committed
Fixed typo in 2-practice-tdd
1 parent b9cda01 commit 16bb366

File tree

3 files changed

+24
-25
lines changed

3 files changed

+24
-25
lines changed
Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
11
// implement a function countChar that counts the number of times a character occurs in a string
22
const countChar = require("./count");
3-
// Given a string str and a single character char to search for,
3+
// Given a string `str` and a single character `char` to search for,
44
// When the countChar function is called with these inputs,
55
// Then it should:
66

77
// Scenario: Multiple Occurrences
8-
// Given the input string str,
9-
// And a character char that may occur multiple times with overlaps within str (e.g., 'a' in 'aaaaa'),
8+
// Given the input string `str`,
9+
// And a character `char` that occurs one or more times in `str` (e.g., 'a' in 'aaaaa'),
1010
// When the function is called with these inputs,
11-
// Then it should correctly count overlapping occurrences of char (e.g., 'a' appears five times in 'aaaaa').
11+
// Then it should correctly count occurrences of `char`.
1212

1313
test("should count multiple occurrences of a character", () => {
1414
const str = "aaaaa";
@@ -18,7 +18,7 @@ test("should count multiple occurrences of a character", () => {
1818
});
1919

2020
// Scenario: No Occurrences
21-
// Given the input string str,
22-
// And a character char that does not exist within the case-sensitive str,
21+
// Given the input string `str`,
22+
// And a character `char` that does not exist within `str`.
2323
// When the function is called with these inputs,
24-
// Then it should return 0, indicating that no occurrences of the char were found in the case-sensitive str.
24+
// Then it should return 0, indicating that no occurrences of `char` were found.
Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,13 @@
11
const getOrdinalNumber = require("./get-ordinal-number");
2-
// In this week's prep, we started implementing getOrdinalNumber
3-
4-
// continue testing and implementing getOrdinalNumber for additional cases
5-
// Write your tests using Jest - remember to run your tests often for continual feedback
2+
// In this week's prep, we started implementing getOrdinalNumber.
63

4+
// Continue testing and implementing getOrdinalNumber for additional cases.
5+
// Write your tests using Jest — remember to run your tests often for continual feedback.
76

87
// To ensure thorough testing, we need broad scenarios that cover all possible cases.
98
// Listing individual values, however, can quickly lead to an unmanageable number of test cases.
109
// Instead of writing tests for individual numbers, consider grouping all possible input values
11-
// into meaningful categories. Then, select representative samples from each category to test.
10+
// into meaningful categories. Then, select representative samples from each category to test.
1211
// This approach improves coverage and makes our tests easier to maintain.
1312

1413
// Case 1: Numbers ending with 1 (but not 11)
@@ -18,4 +17,4 @@ test("should append 'st' for numbers ending with 1, except those ending with 11"
1817
expect(getOrdinalNumber(1)).toEqual("1st");
1918
expect(getOrdinalNumber(21)).toEqual("21st");
2019
expect(getOrdinalNumber(31)).toEqual("131st");
21-
});
20+
});
Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
// Implement a function repeatStr
22
const repeatStr = require("./repeat-str");
3-
// Given a target string str and a positive integer count,
3+
// Given a target string `str` and a positive integer `count`,
44
// When the repeatStr function is called with these inputs,
55
// Then it should:
66

7-
// case: repeat String:
8-
// Given a target string str and a positive integer count,
7+
// Case: handle multiple repetitions:
8+
// Given a target string `str` and a positive integer `count` greater than 1,
99
// When the repeatStr function is called with these inputs,
10-
// Then it should repeat the str count times and return a new string containing the repeated str values.
10+
// Then it should return a string that contains the original `str` repeated `count` times.
1111

1212
test("should repeat the string count times", () => {
1313
const str = "hello";
@@ -16,17 +16,17 @@ test("should repeat the string count times", () => {
1616
expect(repeatedStr).toEqual("hellohellohello");
1717
});
1818

19-
// case: handle Count of 1:
20-
// Given a target string str and a count equal to 1,
19+
// Case: handle count of 1:
20+
// Given a target string `str` and a `count` equal to 1,
2121
// When the repeatStr function is called with these inputs,
22-
// Then it should return the original str without repetition, ensuring that a count of 1 results in no repetition.
22+
// Then it should return the original `str` without repetition.
2323

24-
// case: Handle Count of 0:
25-
// Given a target string str and a count equal to 0,
24+
// Case: Handle count of 0:
25+
// Given a target string `str` and a `count` equal to 0,
2626
// When the repeatStr function is called with these inputs,
27-
// Then it should return an empty string, ensuring that a count of 0 results in an empty output.
27+
// Then it should return an empty string.
2828

29-
// case: Negative Count:
30-
// Given a target string str and a negative integer count,
29+
// Case: Handle negative count:
30+
// Given a target string `str` and a negative integer `count`,
3131
// When the repeatStr function is called with these inputs,
3232
// Then it should throw an error, as negative counts are not valid.

0 commit comments

Comments
 (0)