Migrated tests to jest
Used jest-codemods to migrate, will have to pass everything by hand before we can merge.
This commit is contained in:
@ -1,16 +1,13 @@
|
||||
const test = require('tape');
|
||||
const expect = require('expect');
|
||||
const binarySearch = require('./binarySearch.js');
|
||||
|
||||
test('Testing binarySearch', (t) => {
|
||||
test('Testing binarySearch', () => {
|
||||
//For more information on all the methods supported by tape
|
||||
//Please go to https://github.com/substack/tape
|
||||
t.true(typeof binarySearch === 'function', 'binarySearch is a Function');
|
||||
expect(typeof binarySearch === 'function').toBeTruthy();
|
||||
//t.deepEqual(binarySearch(args..), 'Expected');
|
||||
t.equal(binarySearch([1, 4, 6, 7, 12, 13, 15, 18, 19, 20, 22, 24], 6), 2, 'Finds item in array');
|
||||
t.equal(binarySearch([1, 4, 6, 7, 12, 13, 15, 18, 19, 20, 22, 24], 21), -1, 'Returns -1 when not found');
|
||||
t.equal(binarySearch([], 21), -1, 'Works with empty arrays');
|
||||
t.equal(binarySearch([1], 1), 0, "Works for one element arrays");
|
||||
//t.false(binarySearch(args..), 'Expected');
|
||||
//t.throws(binarySearch(args..), 'Expected');
|
||||
t.end();
|
||||
expect(binarySearch([1, 4, 6, 7, 12, 13, 15, 18, 19, 20, 22, 24], 6)).toBe(2);
|
||||
expect(binarySearch([1, 4, 6, 7, 12, 13, 15, 18, 19, 20, 22, 24], 21)).toBe(-1);
|
||||
expect(binarySearch([], 21)).toBe(-1);
|
||||
expect(binarySearch([1], 1)).toBe(0);
|
||||
});
|
||||
Reference in New Issue
Block a user