Skip to content

Commit

Permalink
Update tests
Browse files Browse the repository at this point in the history
  • Loading branch information
escwxyz committed Apr 19, 2023
1 parent 709fd3c commit 9742a68
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 1 deletion.
13 changes: 13 additions & 0 deletions typescript/src/1-two-sum.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,3 +18,16 @@ export const twoSum = (nums: number[], target: number): number[] => {
}
return arr
}

if (import.meta.vitest) {
const { test, expect } = import.meta.vitest
test('test one', () => {
expect(twoSum([2, 7, 11, 15], 9)).toStrictEqual([1, 0])
})
test('test two', () => {
expect(twoSum([3, 2, 4], 6)).toStrictEqual([2, 1])
})
test('test three', () => {
expect(twoSum([3, 3], 6)).toStrictEqual([1, 0])
})
}
2 changes: 1 addition & 1 deletion typescript/src/27-remove-element.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ if (import.meta.vitest) {
const { it, expect } = import.meta.vitest

it('test one', () => {
expect(removeElement([0, 1, 2, 2, 3, 0, 4, 2], 2)).toBe(2)
expect(removeElement([0, 1, 2, 2, 3, 0, 4, 2], 2)).toBe(5)
})

it('test two', () => {
Expand Down

0 comments on commit 9742a68

Please sign in to comment.