Skip to content

Instantly share code, notes, and snippets.

@Giagnus64
Created January 7, 2020 04:20
Show Gist options
  • Select an option

  • Save Giagnus64/714df5a7fdbe1b8303c6c053e1d88d04 to your computer and use it in GitHub Desktop.

Select an option

Save Giagnus64/714df5a7fdbe1b8303c6c053e1d88d04 to your computer and use it in GitHub Desktop.
Insertion Sort Fixed Tests
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