1010function getAngleType ( angle ) {
1111 if ( angle === 90 ) {
1212 return "Right angle" ;
13+ } else if ( angle < 90 ) {
14+ return "Acute angle" ;
15+ } else if ( angle > 90 && angle < 180 ) {
16+ return "Obtuse angle" ;
17+ } else if ( angle === 180 ) {
18+ return "Straight angle" ;
19+ } else if ( angle > 180 && angle < 360 ) {
20+ return "Reflex angle" ;
1321 }
22+ }
1423 // Run the tests, work out what Case 2 is testing, and implement the required code here.
1524 // Then keep going for the other cases, one at a time.
16- }
25+
1726
1827// The line below allows us to load the getAngleType function into tests in other files.
1928// This will be useful in the "rewrite tests with jest" step.
@@ -39,25 +48,36 @@ function assertEquals(actualOutput, targetOutput) {
3948// Then the function should return "Right angle"
4049const right = getAngleType ( 90 ) ;
4150assertEquals ( right , "Right angle" ) ;
51+ console . log ( getAngleType ( 90 ) ) ;
4252
4353// Case 2: Identify Acute Angles:
4454// When the angle is less than 90 degrees,
4555// Then the function should return "Acute angle"
4656const acute = getAngleType ( 45 ) ;
4757assertEquals ( acute , "Acute angle" ) ;
58+ console . log ( getAngleType ( 45 ) ) ;
4859
4960// Case 3: Identify Obtuse Angles:
5061// When the angle is greater than 90 degrees and less than 180 degrees,
5162// Then the function should return "Obtuse angle"
5263const obtuse = getAngleType ( 120 ) ;
64+ assertEquals ( obtuse , "Obtuse angle" ) ;
65+ console . log ( getAngleType ( 120 ) ) ;
5366// ====> write your test here, and then add a line to pass the test in the function above
5467
5568// Case 4: Identify Straight Angles:
5669// When the angle is exactly 180 degrees,
5770// Then the function should return "Straight angle"
71+ const straight = getAngleType ( 180 ) ;
72+ assertEquals ( straight , "Straight angle" ) ;
73+ console . log ( getAngleType ( 180 ) ) ;
74+
5875// ====> write your test here, and then add a line to pass the test in the function above
5976
6077// Case 5: Identify Reflex Angles:
6178// When the angle is greater than 180 degrees and less than 360 degrees,
6279// Then the function should return "Reflex angle"
80+ const Reflex = getAngleType ( 200 ) ;
81+ assertEquals ( Reflex , "Reflex angle" ) ;
82+ console . log ( getAngleType ( 200 ) ) ;
6383// ====> write your test here, and then add a line to pass the test in the function above
0 commit comments