1515// After you have implemented the function, write tests to cover all the cases, and
1616// execute the code to ensure all tests pass.
1717
18- function getAngleType(angle) {
19- // TODO: Implement this function
20- }
18+ /**
19+ * function getAngleType(angle) {
20+ * // TODO: Implement this function
21+ *}
22+ */
2123
2224// The line below allows us to load the getAngleType function into tests in other files.
2325// This will be useful in the "rewrite tests with jest" step.
24- module.exports = getAngleType;
26+
27+ /**
28+ * module.exports = getAngleType;
29+ */
2530
2631// This helper function is written to make our assertions easier to read.
2732// If the actual output matches the target output, the test will pass
28- function assertEquals(actualOutput, targetOutput) {
29- console.assert(
30- actualOutput === targetOutput,
31- `Expected ${actualOutput} to equal ${targetOutput}`
32- );
33- }
33+
34+ /**
35+ *function assertEquals(actualOutput, targetOutput) {
36+ * console.assert(
37+ * actualOutput === targetOutput,
38+ * `Expected ${actualOutput} to equal ${targetOutput}`
39+ * );
40+ *}
41+ */
3442
3543// TODO: Write tests to cover all cases, including boundary and invalid cases.
3644// Example: Identify Right Angles
37- const right = getAngleType(90);
38- assertEquals(right, "Right angle");
45+
46+ /**
47+ * const right = getAngleType(90);
48+ * assertEquals(right, "Right angle");
49+ */
3950
4051// Solution:
4152// Implement a function getAngleType
@@ -54,7 +65,8 @@ assertEquals(right, "Right angle");
5465// After you have implemented the function, write tests to cover all the cases, and
5566// execute the code to ensure all tests pass.
5667
57- function getAngleType(angle) {
68+ /**
69+ * function getAngleType(angle) {
5870 // Check for invalid angles (outside 0-360 range)
5971 if (angle <= 0 || angle >= 360) {
6072 return "Invalid angle";
@@ -76,24 +88,29 @@ function getAngleType(angle) {
7688 // This line should theoretically never be reached given our conditions,
7789 // but included as a safety net
7890 return "Invalid angle";
79- }
91+ *}
92+ */
8093
8194// The line below allows us to load the getAngleType function into tests in other files.
8295// This will be useful in the "rewrite tests with jest" step.
8396module . exports = getAngleType ;
8497
8598// This helper function is written to make our assertions easier to read.
8699// If the actual output matches the target output, the test will pass
87- function assertEquals(actualOutput, targetOutput) {
88- console.assert(
89- actualOutput === targetOutput,
90- `Expected ${actualOutput} to equal ${targetOutput}`
91- );
92- }
100+
101+ /**
102+ function assertEquals(actualOutput, targetOutput) {
103+ console.assert(
104+ actualOutput === targetOutput,
105+ `Expected ${actualOutput} to equal ${targetOutput}`
106+ );
107+ }
108+ */
93109
94110// Write tests to cover all cases, including boundary and invalid cases.
95111console . log ( "Running tests for getAngleType function...\n" ) ;
96112
113+ /**
97114// Test 1: Acute angles
98115console.log("Testing Acute angles:");
99116const acute1 = getAngleType(45);
0 commit comments