Skip to content

Commit 5465151

Browse files
author
qwik zgheib mossad bashit
committed
feat: #13 - Typescript
1 parent b097083 commit 5465151

File tree

1 file changed

+21
-0
lines changed

1 file changed

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

0 commit comments

Comments
 (0)