Skip to content

Commit

Permalink
add add.test.ts for testing section #1
Browse files Browse the repository at this point in the history
  • Loading branch information
nelsonic committed Jun 15, 2024
1 parent 96257ac commit 2137160
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 3 deletions.
12 changes: 12 additions & 0 deletions add.test.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
import tap, { Test } from 'tap';
import { add } from './add.ts';

tap.test('add two numbers', (t: Test) => {
t.equal(add(1, 2), 3);
t.end();
})

tap.test('add a negative number should work', (t: Test) => {
t.equal(add(1, -2), -1);
t.end();
})
4 changes: 1 addition & 3 deletions add.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
export function add(x: number, y: number): number {
return x + y;
}

console.log(add(1, 2))
}

0 comments on commit 2137160

Please sign in to comment.