Skip to content

Commit e7d7fff

Browse files
author
Payman IB
committed
Update getCardValue function to check for specific card representation and enhance ordinal number tests with clearer descriptions and additional cases
1 parent a124398 commit e7d7fff

File tree

2 files changed

+15
-8
lines changed

2 files changed

+15
-8
lines changed

Sprint-3/1-implement-and-rewrite-tests/implement/3-get-card-value.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
// write one test at a time, and make it pass, build your solution up methodically
99
// just make one change at a time -- don't rush -- programmers are deep and careful thinkers
1010
function getCardValue(card) {
11-
if (rank === "A") {
11+
if (card === "A") {
1212
return 11;
1313
}
1414
}

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

Lines changed: 14 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -8,19 +8,26 @@ 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("append 'nd' to numbers ending in 1, except those ending in 11", () => {
1212
expect(getOrdinalNumber(1)).toEqual("1st");
13+
expect( getOrdinalNumber(21) ).toEqual("21st");
14+
expect( getOrdinalNumber(131) ).toEqual("131st");
1315
});
1416

15-
test("should return '2nd' for 2", () => {
16-
expect(getOrdinalNumber(2)).toEqual("2nd");
17+
test("append 'nd' to numbers ending in 2, except those ending in 12", () => {
18+
expect( getOrdinalNumber(2) ).toEqual("2nd");
19+
expect( getOrdinalNumber(22) ).toEqual("22nd");
20+
expect( getOrdinalNumber(132) ).toEqual("132nd");
1721
});
18-
19-
test("should return '3rd' for 3", () => {
22+
test("append 'rd' to numbers ending in 3, except those ending in 13", () => {
2023
expect(getOrdinalNumber(3)).toEqual("3rd");
24+
expect( getOrdinalNumber(33) ).toEqual("33rd");
25+
expect( getOrdinalNumber(133) ).toEqual("133rd");
2126
});
22-
test("should return '24th' for 24", () => {
23-
expect(getOrdinalNumber(24)).toEqual("24th");
27+
test("append 'th' to numbers ending in 4, except those ending in 14", () => {
28+
expect(getOrdinalNumber(4)).toEqual("4th");
29+
expect( getOrdinalNumber(24) ).toEqual("24th");
30+
expect( getOrdinalNumber(134) ).toEqual("134th");
2431
});
2532
test("should return '11th' for 11", () => {
2633
expect(getOrdinalNumber(11)).toEqual("11th");

0 commit comments

Comments
 (0)