1
- const { add, addAll, subtract, multiply } = require ( "./operations" ) ;
1
+ const { add, addAll, subtract, multiply, divide } = require ( "./operations" ) ;
2
2
3
3
//Testing Add implementation
4
4
describe ( "Testing Add implementation" , ( ) => {
@@ -37,7 +37,7 @@ describe("Testing Subbtaction implementation", () => {
37
37
it ( "Subtraction of 23 and 50" , ( ) => {
38
38
expect ( subtract ( 23 , 50 ) ) . toBe ( - 27 ) ;
39
39
} ) ;
40
- it ( "Subtraction of 21 and 111 " , ( ) => {
40
+ it ( "Subtraction of 111 and 21 " , ( ) => {
41
41
expect ( subtract ( 111 , 21 ) ) . toBe ( 90 ) ;
42
42
} ) ;
43
43
it ( "Parameter should only be Numbers" , ( ) => {
@@ -50,10 +50,10 @@ describe("Testing Multiply implimentation", () => {
50
50
it ( "Multiplication of 4 and 4" , ( ) => {
51
51
expect ( multiply ( 4 , 4 ) ) . toBe ( 16 ) ;
52
52
} ) ;
53
- it ( "Multiplication of 1 and 1 " , ( ) => {
53
+ it ( "Multiplication of many numbers " , ( ) => {
54
54
expect ( multiply ( 1 , 1 , 2 , 3 , 4 ) ) . toBe ( 24 ) ;
55
55
} ) ;
56
- it ( "Multiplication of 1 and 1 " , ( ) => {
56
+ it ( "Multiplication of 11 and -8 " , ( ) => {
57
57
expect ( multiply ( 11 , - 8 ) ) . toBe ( - 88 ) ;
58
58
} ) ;
59
59
it ( "Multiplication of 1132 and 1131331" , ( ) => {
@@ -65,4 +65,17 @@ describe("Testing Multiply implimentation", () => {
65
65
}
66
66
expect ( logError ) . toThrowError ( Error ) ;
67
67
} ) ;
68
- } ) ;
68
+ } ) ;
69
+
70
+ //Testing Division implementation
71
+ describe ( "Testing Division implementation" , ( ) => {
72
+ it ( "Subtraction of 1 and 2" , ( ) => {
73
+ expect ( divide ( 1 , 2 ) ) . toBe ( 0.5 ) ;
74
+ } ) ;
75
+ it ( "Subtraction of 100 and 25" , ( ) => {
76
+ expect ( divide ( 100 , 25 ) ) . toBe ( 4 ) ;
77
+ } ) ;
78
+ it ( "Parameter should only be Numbers" , ( ) => {
79
+ expect ( divide ( 3 , "4" ) ) . toBeFalsy ( ) ;
80
+ } ) ;
81
+ } ) ;
0 commit comments