Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 9 additions & 1 deletion math.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,12 @@ function subtract(a, b) {
return a - b;
}

module.exports = { add, subtract };
function multiply(a, b) {
return a * b;
}

function divide(a, b) {
return a / b;
}

module.exports = { add, subtract, multiply, divide };
10 changes: 9 additions & 1 deletion math.test.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
const { add, subtract } = require("./math");
const { add, subtract, multiply, divide } = require("./math");

it("should add two numbers", () => {
expect(add(1, 2)).toBe(3);
Expand All @@ -7,3 +7,11 @@ it("should add two numbers", () => {
it("should subtract two numbers", () => {
expect(subtract(1, 2)).toBe(-1);
});

it("should multiply two numbers", () => {
expect(multiply(2, 3)).toBe(6);
});

it("should divide two numbers", () => {
expect(divide(1, 2)).toBe(0.5);
});