Skip to content

Commit b097083

Browse files
author
qwik zgheib mossad bashit
committed
feat: #13 - Javascript
1 parent 20a5890 commit b097083

File tree

1 file changed

+20
-0
lines changed

1 file changed

+20
-0
lines changed
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
import assert from "assert";
2+
export const sum = (a, b) => a + b;
3+
4+
function test(description, fn) {
5+
try {
6+
fn();
7+
console.log(`✔️ ${description}`);
8+
} catch (error) {
9+
console.log(`❌ ${description}`);
10+
console.error(error);
11+
}
12+
}
13+
14+
test("adds 1 + 2 to equal 3", () => {
15+
assert.strictEqual(sum(1, 2), 3);
16+
});
17+
18+
test("adds 1 + 1 to equal 2", () => {
19+
assert.strictEqual(sum(1, 1), 2);
20+
});

0 commit comments

Comments
 (0)