Skip to content

Commit 61ee224

Browse files
authored
merge: Add test case to Find Second Largest Element Algorithm (#1037)
1 parent dbffac2 commit 61ee224

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
import { secondLargestElement } from '../FindSecondLargestElement'
2+
3+
test('The second largest element of the array [1, 2, 3, 4, 5] is 4', () => {
4+
const array = [1, 2, 3, 4, 5]
5+
const res = secondLargestElement(array)
6+
expect(res).toEqual(4)
7+
})
8+
9+
test('The second largest element of the array [-1, -2, -3, -4, -5] is -2', () => {
10+
const array = [-1, -2, -3, -4, -5]
11+
const res = secondLargestElement(array)
12+
expect(res).toEqual(-2)
13+
})

0 commit comments

Comments
 (0)