Skip to content

Commit 88bd4e6

Browse files
Implement and test getAngleType with full boundary coverage
1 parent 1e09358 commit 88bd4e6

File tree

3 files changed

+24
-2
lines changed

3 files changed

+24
-2
lines changed

Sprint-3/1-implement-and-rewrite-tests/implement/1-get-angle-type.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ function getAngleType(angle) {
4343

4444
// The line below allows us to load the getAngleType function into tests in other files.
4545
// This will be useful in the "rewrite tests with jest" step.
46-
//module.exports = getAngleType;
46+
module.exports = getAngleType;
4747

4848
// This helper function is written to make our assertions easier to read.
4949
// If the actual output matches the target output, the test will pass

Sprint-3/1-implement-and-rewrite-tests/rewrite-tests-with-jest/1-get-angle-type.test.js

Lines changed: 20 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,28 @@ const getAngleType = require("../implement/1-get-angle-type");
99
test(`should return "Acute angle" when (0 < angle < 90)`, () => {
1010
// Test various acute angles, including boundary cases
1111
expect(getAngleType(1)).toEqual("Acute angle");
12-
expect(getAngleType(45)).toEqual("Acute angle");
12+
//expect(getAngleType(45)).toEqual("Acute angle");
1313
expect(getAngleType(89)).toEqual("Acute angle");
1414
});
15+
test(`should return "Right angle" when (angle = 90)`, () => {
16+
// Test various acute angles, including boundary cases
17+
expect(getAngleType(90)).toEqual("Right angle");
18+
});
19+
test(`should return"Obtuse angle" when (90 < angle< 180)`, ()=>{
20+
expect(getAngleType(91)).toEqual("Obtuse angle");
21+
expect(getAngleType(179)).toEqual("Obtuse angle");
22+
});
23+
test(`should return "Straight angle" when ( angle = 180)`,()=>{
24+
expect(getAngleType(180)).toEqual("Straight angle");
25+
});
26+
test(`should return "Reflex angle" when (180 < angle <360)`, ()=>{
27+
expect(getAngleType(181)).toEqual("Reflex angle");
28+
expect(getAngleType(359)).toEqual("Reflex angle");
29+
30+
});
31+
test(`should return "invalid angle when angles outside the valid range`, ()=>{
32+
expect(getAngleType(0)).toEqual("Invalid angle")
33+
})
1534

1635
// Case 2: Right angle
1736
// Case 3: Obtuse angles

Sprint-3/3-dead-code/newFile.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
const { sayHello } = require("./exercise-1");
2+
3+
console.log(sayHello("hello , ", Arun, "));"));

0 commit comments

Comments
 (0)