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:
6
test6/sortedIndex/sortedIndex.js
Normal file
6
test6/sortedIndex/sortedIndex.js
Normal file
@ -0,0 +1,6 @@
|
||||
const sortedIndex = (arr, n) => {
|
||||
const isDescending = arr[0] > arr[arr.length - 1];
|
||||
const index = arr.findIndex(el => (isDescending ? n >= el : n <= el));
|
||||
return index === -1 ? arr.length : index;
|
||||
};
|
||||
module.exports = sortedIndex;
|
||||
10
test6/sortedIndex/sortedIndex.test.js
Normal file
10
test6/sortedIndex/sortedIndex.test.js
Normal file
@ -0,0 +1,10 @@
|
||||
const expect = require('expect');
|
||||
const sortedIndex = require('./sortedIndex.js');
|
||||
|
||||
test('Testing sortedIndex', () => {
|
||||
//For more information on all the methods supported by tape
|
||||
//Please go to https://github.com/substack/tape
|
||||
expect(typeof sortedIndex === 'function').toBeTruthy();
|
||||
expect(sortedIndex([5, 3, 2, 1], 4)).toBe(1);
|
||||
expect(sortedIndex([30, 50], 40)).toBe(1);
|
||||
});
|
||||
Reference in New Issue
Block a user