mirror of
https://github.com/TheAlgorithms/JavaScript.git
synced 2025-07-07 19:17:33 +08:00
14 lines
452 B
JavaScript
14 lines
452 B
JavaScript
import { secondLargestElement } from '../FindSecondLargestElement'
|
|
|
|
test('The second largest element of the array [1, 2, 3, 4, 5] is 4', () => {
|
|
const array = [1, 2, 3, 4, 5]
|
|
const res = secondLargestElement(array)
|
|
expect(res).toEqual(4)
|
|
})
|
|
|
|
test('The second largest element of the array [-1, -2, -3, -4, -5] is -2', () => {
|
|
const array = [-1, -2, -3, -4, -5]
|
|
const res = secondLargestElement(array)
|
|
expect(res).toEqual(-2)
|
|
})
|