Skip to content

Commit

Permalink
Feat: add tests
Browse files Browse the repository at this point in the history
  • Loading branch information
MCYJ committed Dec 9, 2024
1 parent 6228f74 commit 2ff9d4b
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 0 deletions.
10 changes: 10 additions & 0 deletions math.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
// math.js
function add(a, b) {
return a + b;
}

function subtract(a, b) {
return a - b;
}

module.exports = { add, subtract };
10 changes: 10 additions & 0 deletions math.test.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
// math.test.js
const { add, subtract } = require('./math');

test('adds 1 + 2 to equal 3', () => {
expect(add(1, 2)).toBe(3);
});

test('subtracts 5 - 3 to equal 2', () => {
expect(subtract(5, 3)).toBe(2);
});

0 comments on commit 2ff9d4b

Please sign in to comment.