Skip to content

Commit

Permalink
merge: Add test case to Find Second Largest Element Algorithm (TheAlg…
Browse files Browse the repository at this point in the history
  • Loading branch information
Ankush263 authored Jun 5, 2022
1 parent dbffac2 commit 61ee224
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions Sorts/test/FindSecondLargestElement.test.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
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)
})

0 comments on commit 61ee224

Please sign in to comment.