Skip to content

Commit ec67b3b

Browse files
committed
test(sprint-3): add Jest tests for getAngleType function
1 parent 20bc441 commit ec67b3b

File tree

1 file changed

+21
-17
lines changed

1 file changed

+21
-17
lines changed
Lines changed: 21 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,26 +1,30 @@
1-
// This statement loads the getAngleType function you wrote in the implement directory.
2-
// We will use the same function, but write tests for it using Jest in this file.
31
const getAngleType = require("../implement/1-get-angle-type");
42

53
test("should identify right angle (90°)", () => {
64
expect(getAngleType(90)).toEqual("Right angle");
75
});
86

9-
// REPLACE the comments with the tests
10-
// make your test descriptions as clear and readable as possible
11-
12-
// Case 2: Identify Acute Angles:
13-
// When the angle is less than 90 degrees,
14-
// Then the function should return "Acute angle"
7+
test("should identify acute angle (< 90°)", () => {
8+
expect(getAngleType(45)).toEqual("Acute angle");
9+
expect(getAngleType(30)).toEqual("Acute angle");
10+
expect(getAngleType(1)).toEqual("Acute angle");
11+
expect(getAngleType(89)).toEqual("Acute angle");
12+
});
1513

16-
// Case 3: Identify Obtuse Angles:
17-
// When the angle is greater than 90 degrees and less than 180 degrees,
18-
// Then the function should return "Obtuse angle"
14+
test("should identify obtuse angle (> 90° and < 180°)", () => {
15+
expect(getAngleType(120)).toEqual("Obtuse angle");
16+
expect(getAngleType(135)).toEqual("Obtuse angle");
17+
expect(getAngleType(91)).toEqual("Obtuse angle");
18+
expect(getAngleType(179)).toEqual("Obtuse angle");
19+
});
1920

20-
// Case 4: Identify Straight Angles:
21-
// When the angle is exactly 180 degrees,
22-
// Then the function should return "Straight angle"
21+
test("should identify straight angle (180°)", () => {
22+
expect(getAngleType(180)).toEqual("Straight angle");
23+
});
2324

24-
// Case 5: Identify Reflex Angles:
25-
// When the angle is greater than 180 degrees and less than 360 degrees,
26-
// Then the function should return "Reflex angle"
25+
test("should identify reflex angle (> 180° and < 360°)", () => {
26+
expect(getAngleType(270)).toEqual("Reflex angle");
27+
expect(getAngleType(181)).toEqual("Reflex angle");
28+
expect(getAngleType(359)).toEqual("Reflex angle");
29+
expect(getAngleType(200)).toEqual("Reflex angle");
30+
});

0 commit comments

Comments
 (0)