Skip to content

Commit 54df026

Browse files
authored
Refactor tests for non-integer input handling
Updated test cases to ensure non-integer inputs throw errors instead of returning ordinal strings.
1 parent 3d45d8a commit 54df026

1 file changed

Lines changed: 3 additions & 4 deletions

File tree

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

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -51,10 +51,9 @@ test("should append 'th' for numbers ending with 4-9 or 0", () => {
5151
expect(getOrdinalNumber(0)).toBe("0th");
5252
});
5353

54-
test("non-integer and negative numbers should be handled correctly", () => {
55-
expect(getOrdinalNumber(1.5)).toBe("1.5th");
56-
expect(getOrdinalNumber(-2.3)).toBe("-2.3th");
57-
expect(getOrdinalNumber(-11)).toBe("-11th");
54+
test("non-integer numbers should throw an error", () => {
55+
expect(() => getOrdinalNumber(1.5)).toThrow("Input must be an integer");
56+
expect(() => getOrdinalNumber(-2.3)).toThrow("Input must be an integer");
5857
});
5958

6059
test("invalid input should throw an error", () => {

0 commit comments

Comments
 (0)