Skip to content

Instantly share code, notes, and snippets.

@Giagnus64
Last active January 7, 2020 04:03
Show Gist options
  • Select an option

  • Save Giagnus64/30d08c1abf75cbc15fb5770dbd688d28 to your computer and use it in GitHub Desktop.

Select an option

Save Giagnus64/30d08c1abf75cbc15fb5770dbd688d28 to your computer and use it in GitHub Desktop.
Insertion Sort Initial Tests
const {insertionSort, swap} = require('./app');
//unit test
test('Swaps two array entries', () => {
expect(swap([1,2,3], 0, 1)).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