Skip to content

Commit a0be617

Browse files
fix: revert files to orginal
1 parent 7bcf484 commit a0be617

4 files changed

Lines changed: 3 additions & 68 deletions

File tree

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

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

2020
// Scenario: No Occurrences
21-
test(`should return zero the character doesn't exist in the string`, () => {
22-
const str = "bravo";
23-
const char = "u";
24-
const count = countChar(str, char);
25-
expect(count).toEqual(0);
26-
});
27-
28-
// Empty String
29-
test(`should return zero when the string is empty`, () => {
30-
expect(countChar("", "a")).toEqual(0);
31-
});
32-
33-
// Scenario: Multiple Occurrences
34-
test("should count multiple occurrences of characters (including mixed and case-sensitive)", () => {
35-
expect(countChar("aaaaa", "a")).toEqual(5); // simple multiple
36-
expect(countChar("1-2-3-4-5-", "-")).toEqual(5); // mixed characters
37-
expect(countChar("AaAa", "A")).toEqual(2); // case sensitivity
38-
});
39-
4021
// Given the input string `str`,
4122
// And a character `char` that does not exist within `str`.
4223
// When the function is called with these inputs,

Sprint-3/2-practice-tdd/get-ordinal-number.test.js

Lines changed: 0 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -13,37 +13,8 @@ const getOrdinalNumber = require("./get-ordinal-number");
1313
// Case 1: Numbers ending with 1 (but not 11)
1414
// When the number ends with 1, except those ending with 11,
1515
// Then the function should return a string by appending "st" to the number.
16-
1716
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(131)).toEqual("131st");
2120
});
22-
23-
// Case 2: Numbers ending with 2 (but NOT 12)
24-
test("should append 'nd' for numbers ending with 2, except those ending with 12", () => {
25-
expect(getOrdinalNumber(2)).toEqual("2nd");
26-
expect(getOrdinalNumber(22)).toEqual("22nd");
27-
expect(getOrdinalNumber(102)).toEqual("102");
28-
});
29-
30-
// Case 3: Numbers ending with 3 (but NOT 13)
31-
test("should append 'rd' for numbers ending with 3, except those ending with 13", () => {
32-
expect(getOrdinalNumber(3)).toEqual("3rd");
33-
expect(getOrdinalNumber(33)).toEqual("33rd");
34-
expect(getOrdinalNumber(103)).toEqual("103rd");
35-
});
36-
37-
// Case 4: Numbers ending with 11, 12, or 13 --- 11,12,13,111,121,131,
38-
test("should append 'th' for numbers ending with 11, 12, 13", () => {
39-
expect(getOrdinalNumber(11)).toEqual("11th");
40-
expect(getOrdinalNumber(12)).toEqual("12th");
41-
expect(getOrdinalNumber(13)).toEqual("13th");
42-
});
43-
44-
// Case 5: Numbers ending with larger numbers of 111, 121, 131
45-
test("should append 'th' for numbers ending with 111, 121, 131", () => {
46-
expect(getOrdinalNumber(111)).toEqual("111th");
47-
expect(getOrdinalNumber(121)).toEqual("121th");
48-
expect(getOrdinalNumber(131)).toEqual("131th");
49-
});
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
1-
function repeatStr(str, count) {
1+
function repeatStr() {
22
// Your implementation of this function must *not* call String.prototype.repeat (https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/repeat).
33
// The goal is to re-implement that function, not to use it.
4-
return str.repeat(count);
4+
return "hellohellohello";
55
}
66

77
module.exports = repeatStr;

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

Lines changed: 1 addition & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -11,39 +11,22 @@ const repeatStr = require("./repeat-str");
1111

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

1919
// Case: handle count of 1:
20-
test("should repeat the string count of 1", () => {
21-
const str = "fella";
22-
const count = 1;
23-
const repeatedStr = repeatStr(str, count);
24-
expect(repeatedStr).toEqual("fella");
25-
});
26-
2720
// Given a target string `str` and a `count` equal to 1,
2821
// When the repeatStr function is called with these inputs,
2922
// Then it should return the original `str` without repetition.
3023

3124
// Case: Handle count of 0:
32-
test("should repeat the string count of 0", () => {
33-
const str = "fella";
34-
const count = 0;
35-
const repeatedStr = repeatStr(str, count);
36-
expect(repeatedStr).toEqual("");
37-
});
38-
3925
// Given a target string `str` and a `count` equal to 0,
4026
// When the repeatStr function is called with these inputs,
4127
// Then it should return an empty string.
4228

4329
// Case: Handle negative count:
44-
test(`should throw an error for negative count`, () => {
45-
expect(() => repeatedStr("fella", -2)).toThrowError();
46-
});
4730
// Given a target string `str` and a negative integer `count`,
4831
// When the repeatStr function is called with these inputs,
4932
// Then it should throw an error, as negative counts are not valid.

0 commit comments

Comments
 (0)