Skip to content

Commit 699146f

Browse files
authored
merge: Add test case to secondLargestElement Algorithm (TheAlgorithms#945)
1 parent ecf7cf9 commit 699146f

File tree

1 file changed

+25
-0
lines changed

1 file changed

+25
-0
lines changed
+25
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
import { secondLargestElement } from '../FindSecondLargestElement'
2+
3+
test('The second largest element of the array [100, 200, 300, 400] is 300', () => {
4+
const array = [100, 200, 300, 400]
5+
const res = secondLargestElement(array)
6+
expect(res).toBe(300)
7+
})
8+
9+
test('The second largest element of the array [1100, 2400, 1300, 4002] is 2400', () => {
10+
const array = [1100, 2400, 1300, 4002]
11+
const res = secondLargestElement(array)
12+
expect(res).toBe(2400)
13+
})
14+
15+
test('The second largest element of the array [10, 20, 39, 34] is 34', () => {
16+
const array = [10, 20, 39, 34]
17+
const res = secondLargestElement(array)
18+
expect(res).toBe(34)
19+
})
20+
21+
test('The second largest element of the array [1, 20, 3, 40] is 20', () => {
22+
const array = [1, 20, 3, 40]
23+
const res = secondLargestElement(array)
24+
expect(res).toBe(20)
25+
})

0 commit comments

Comments
 (0)