@@ -36,3 +36,79 @@ test("should identify straight angle (180°)", () => {
3636test ( "should identify reflex angle (>180° and <360°)" , ( ) => {
3737 expect ( getAngleType ( 250 ) ) . toEqual ( "Reflex angle" ) ;
3838} ) ;
39+
40+ // Case 6: Identify Full Rotation:
41+ // When the angle is exactly 360 degrees,
42+ // Then the function should return "Full rotation"
43+ test ( "should identify full rotation (360°)" , ( ) => {
44+ expect ( getAngleType ( 360 ) ) . toEqual ( "Full rotation" ) ;
45+ } ) ;
46+
47+ // Case 7: input is a number in string
48+ test ( "should return as usual when input is a number in string" , ( ) => {
49+ expect ( getAngleType ( "90" ) ) . toEqual ( "Right angle" ) ;
50+ } ) ;
51+
52+ // Case 8: input is not a number
53+ test ( "should return 'Input should be a number or a number in string' when input is not a number" , ( ) => {
54+ expect ( getAngleType ( "hello" ) ) . toEqual (
55+ "Input should be a number or a number in string"
56+ ) ;
57+ } ) ;
58+
59+ // Case 9: input is less than 0
60+ test ( "should return 'Angle should be between 0 and 360' when input is less than 0" , ( ) => {
61+ expect ( getAngleType ( - 10 ) ) . toEqual ( "Angle should be between 0 and 360" ) ;
62+ } ) ;
63+
64+ // Case 10: input is greater than 360
65+ test ( "should return 'Angle should be between 0 and 360' when input is greater than 360" , ( ) => {
66+ expect ( getAngleType ( 400 ) ) . toEqual ( "Angle should be between 0 and 360" ) ;
67+ } ) ;
68+
69+ // Case 11: input is exactly 0
70+ test ( "should identify zero angle (0°)" , ( ) => {
71+ expect ( getAngleType ( 0 ) ) . toEqual ( "Zero angle" ) ;
72+ } ) ;
73+
74+ // Case 12: input is empty
75+ test ( "should return 'Input should be a number or a number in string' when input is empty" , ( ) => {
76+ expect ( getAngleType ( ) ) . toEqual (
77+ "Input should be a number or a number in string"
78+ ) ;
79+ } ) ;
80+
81+ // Case 13: input is null
82+ test ( "should return 'Input should be a number or a number in string' when input is null" , ( ) => {
83+ expect ( getAngleType ( null ) ) . toEqual (
84+ "Input should be a number or a number in string"
85+ ) ;
86+ } ) ;
87+
88+ // Case 14: input is NaN
89+ test ( "should return 'Input should be a number or a number in string' when input is NaN" , ( ) => {
90+ expect ( getAngleType ( NaN ) ) . toEqual (
91+ "Input should be a number or a number in string"
92+ ) ;
93+ } ) ;
94+
95+ // Case 15: input is undefined
96+ test ( "should return 'Input should be a number or a number in string' when input is undefined" , ( ) => {
97+ expect ( getAngleType ( undefined ) ) . toEqual (
98+ "Input should be a number or a number in string"
99+ ) ;
100+ } ) ;
101+
102+ // Case 16: input is an object
103+ test ( "should return 'Input should be a number or a number in string' when input is an object" , ( ) => {
104+ expect ( getAngleType ( { } ) ) . toEqual (
105+ "Input should be a number or a number in string"
106+ ) ;
107+ } ) ;
108+
109+ // Case 17: input is an array
110+ test ( "should return 'Input should be a number or a number in string' when input is an array" , ( ) => {
111+ expect ( getAngleType ( [ ] ) ) . toEqual (
112+ "Input should be a number or a number in string"
113+ ) ;
114+ } ) ;
0 commit comments