Skip to content

Commit f715440

Browse files
committed
Update test descriptions for TDD
1 parent b24ce7f commit f715440

File tree

1 file changed

+13
-19
lines changed

1 file changed

+13
-19
lines changed

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

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

11-
test("1 becomes '1st'", () => {
11+
test("should append 'st' when the number ends with 1 but not 11", () => {
1212
expect(getOrdinalNumber(1)).toEqual("1st");
13+
expect(getOrdinalNumber(21)).toEqual("21st");
14+
expect(getOrdinalNumber(101)).toEqual("101st");
1315
});
1416

15-
test("2 becomes '2nd'", () => {
17+
test("should append 'nd' when the number ends with 2 (but not 12)", () => {
1618
expect(getOrdinalNumber(2)).toEqual("2nd");
19+
expect(getOrdinalNumber(22)).toEqual("22nd");
20+
expect(getOrdinalNumber(102)).toEqual("102nd");
1721
});
1822

19-
test("3 becomes '3rd'", () => {
23+
test("should append 'rd' when the number ends with 3 (but not 13)", () => {
2024
expect(getOrdinalNumber(3)).toEqual("3rd");
25+
expect(getOrdinalNumber(23)).toEqual("23rd");
26+
expect(getOrdinalNumber(103)).toEqual("103rd");
2127
});
2228

23-
test("4 becomes '4th'", () => {
24-
expect(getOrdinalNumber(4)).toEqual("4th");
25-
});
26-
27-
test("11, 12, 13 and 111, 112, 113 all become 'th' endings", () => {
29+
test("should append 'th' when the number ends with 11, 12, or 13", () => {
2830
expect(getOrdinalNumber(11)).toEqual("11th");
2931
expect(getOrdinalNumber(12)).toEqual("12th");
3032
expect(getOrdinalNumber(13)).toEqual("13th");
@@ -33,18 +35,10 @@ test("11, 12, 13 and 111, 112, 113 all become 'th' endings", () => {
3335
expect(getOrdinalNumber(113)).toEqual("113th");
3436
});
3537

36-
test("21, 22, 23 and 101, 102, 103 get correct 'st', 'nd', 'rd' endings", () => {
37-
expect(getOrdinalNumber(21)).toEqual("21st");
38-
expect(getOrdinalNumber(22)).toEqual("22nd");
39-
expect(getOrdinalNumber(23)).toEqual("23rd");
40-
expect(getOrdinalNumber(101)).toEqual("101st");
41-
expect(getOrdinalNumber(102)).toEqual("102nd");
42-
expect(getOrdinalNumber(103)).toEqual("103rd");
43-
});
44-
45-
test("5, 10, 24, 100 all end with 'th'", () => {
38+
test("should append 'th' when the number ends with 0, 4, 5, 6, 7, 8, or 9", () => {
39+
expect(getOrdinalNumber(4)).toEqual("4th");
4640
expect(getOrdinalNumber(5)).toEqual("5th");
4741
expect(getOrdinalNumber(10)).toEqual("10th");
4842
expect(getOrdinalNumber(24)).toEqual("24th");
4943
expect(getOrdinalNumber(100)).toEqual("100th");
50-
});
44+
});

0 commit comments

Comments
 (0)