Created
January 7, 2020 04:20
-
-
Save Giagnus64/714df5a7fdbe1b8303c6c053e1d88d04 to your computer and use it in GitHub Desktop.
Insertion Sort Fixed Tests
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| const {insertionSort, swap} = require('./app'); | |
| //unit test | |
| test('Swaps two array entries', () => { | |
| const arr1 = [1,2,3] | |
| swap(arr1, 0, 1); | |
| expect(arr1).toStrictEqual([2,1,3]); | |
| }); | |
| //integration test | |
| test('Sorts array from lowest to highest - insertion sort', () => { | |
| expect (insertionSort([8,5,3,1,2,4])).toStrictEqual([1,2,3,4,5,8]); | |
| expect (insertionSort([1,2,4])).toStrictEqual([1,2,4]); | |
| }); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment