Skip to content

Commit 5aeb5c0

Browse files
committed
prepare tests for all valid integers.
1 parent ba0f73e commit 5aeb5c0

File tree

2 files changed

+8
-2
lines changed

2 files changed

+8
-2
lines changed

Sprint-3/3-mandatory-practice/implement/get-ordinal-number.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ function getOrdinalNumber(n) {
99
ord = "rd";
1010
}
1111

12-
return ord;
12+
return n + ord;
1313
}
1414
console.log(getOrdinalNumber(1)); // The output should be "1st"
1515

Sprint-3/3-mandatory-practice/implement/get-ordinal-number.test.js

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,12 @@ const getOrdinalNumber = require("./get-ordinal-number");
88
// When the number is 1,
99
// Then the function should return "1st"
1010

11-
test("should return '1st' for 1", () => {
11+
//test("should return '1st' for 1", () => {
12+
//expect(getOrdinalNumber(1)).toEqual("1st");
13+
//});
14+
15+
test("append 'st' to numbers ending in 1, except those ending in 11", () => {
1216
expect(getOrdinalNumber(1)).toEqual("1st");
17+
expect(getOrdinalNumber(21)).toEqual("21st");
18+
expect(getOrdinalNumber(121)).toEqual("121st");
1319
});

0 commit comments

Comments
 (0)