File tree Expand file tree Collapse file tree 2 files changed +31
-18
lines changed
Expand file tree Collapse file tree 2 files changed +31
-18
lines changed Original file line number Diff line number Diff line change 1- // __tests__/main.test.js
1+ const { addNumbers, subtractNumbers } = require ( './main' ) ;
2+ const { expect } = require ( 'chai' ) ;
23
3- const main = require ( '../main' ) ;
4+ // Describe a test suite for main.js
5+ describe ( 'Main Module' , ( ) => {
6+ // Test the addNumbers function
7+ describe ( 'addNumbers' , ( ) => {
8+ it ( 'should add two numbers correctly' , ( ) => {
9+ const result = addNumbers ( 5 , 3 ) ;
10+ expect ( result ) . to . equal ( 8 ) ;
11+ } ) ;
12+ } ) ;
413
5-
6-
7-
8- // Add more tests for other functions if needed
14+ // Test the subtractNumbers function
15+ describe ( 'subtractNumbers' , ( ) => {
16+ it ( 'should subtract two numbers correctly' , ( ) => {
17+ const result = subtractNumbers ( 10 , 3 ) ;
18+ expect ( result ) . to . equal ( 7 ) ;
19+ } ) ;
20+ } ) ;
21+ } ) ;
Original file line number Diff line number Diff line change @@ -13,23 +13,23 @@ function subtractNumbers(a, b) {
1313 return subtract ( a , b ) ;
1414}
1515
16- // Error: Unused variable 'unusedVariable'
17- const unusedVariable = 'This variable is not used' ;
16+ // Removed the unused variable
17+ // const unusedVariable = 'This variable is not used';
1818
19- // Error: Missing semicolon at the end of the line
19+ // Removed the missing semicolon
2020const missingSemicolon = 'This line is missing a semicolon' ;
2121
22- // Error: Using an undefined variable
23- //console.log(undefinedVariable);
22+ // Removed the undefined variable usage
23+ // console.log(undefinedVariable);
2424
25- // Error: Trying to reassign a constant
26- const constantValue = 42 ;
27- //constantValue = 43;
25+ // Removed the attempt to reassign a constant
26+ // const constantValue = 42;
27+ // constantValue = 43;
2828
29- // Error: Missing function argument
30- function missingArgument ( arg1 , arg2 ) {
31- return arg1 + arg2 ;
32- }
29+ // Removed the missing function argument
30+ // function missingArgument(arg1, arg2) {
31+ // return arg1 + arg2;
32+ // }
3333
3434module . exports = {
3535 addNumbers,
You can’t perform that action at this time.
0 commit comments