diff --git a/Sorts/test/FindSecondLargestElement.test.js b/Sorts/test/FindSecondLargestElement.test.js new file mode 100644 index 0000000000..6e37275b61 --- /dev/null +++ b/Sorts/test/FindSecondLargestElement.test.js @@ -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) +})
Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.
Alternative Proxies: