-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathget-ordinal-number.test.js
More file actions
25 lines (19 loc) · 829 Bytes
/
get-ordinal-number.test.js
File metadata and controls
25 lines (19 loc) · 829 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
const getOrdinalNumber = require("./get-ordinal-number");
// In this week's prep, we started implementing getOrdinalNumber
// continue testing and implementing getOrdinalNumber for additional cases
// Write your tests using Jest - remember to run your tests often for continual feedback
// Case 1: Identify the ordinal number for 1
// When the number is 1,
// Then the function should return "1st"
test("should return '1st' for 1", () => {
expect(getOrdinalNumber(1)).toEqual("1st");
});
test("should return '2nd' for 2", () => {
expect(getOrdinalNumber(2)).toEqual("2nd");
});
test("should return '3rd' for 3", () => {
expect(getOrdinalNumber(3)).toEqual("3rd");
});
test("should return any number between 4 and 20 with a suffix of 'th' at end of number", () => {
expect(getOrdinalNumber(10)).toEqual("10th");
});