Skip to content

Commit 7c3ab8e

Browse files
committed
fixed a few more things for the example
1 parent 2857c92 commit 7c3ab8e

File tree

2 files changed

+31
-18
lines changed

2 files changed

+31
-18
lines changed

__tests__/main.test.js

Lines changed: 19 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,21 @@
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+
});

main.js

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff 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
2020
const 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

3434
module.exports = {
3535
addNumbers,

0 commit comments

Comments
 (0)