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,22 +1,21 @@
|
||||
const test = require('tape');
|
||||
const expect = require('expect');
|
||||
const chunk = require('./chunk.js');
|
||||
|
||||
test('Testing chunk', (t) => {
|
||||
test('Testing chunk', () => {
|
||||
//For more information on all the methods supported by tape
|
||||
//Please go to https://github.com/substack/tape
|
||||
t.true(typeof chunk === 'function', 'chunk is a Function');
|
||||
t.deepEqual(chunk([1, 2, 3, 4, 5], 2), [[1,2],[3,4],[5]], "chunk([1, 2, 3, 4, 5], 2) returns [[1,2],[3,4],[5]] ");
|
||||
t.deepEqual(chunk([]), [], 'chunk([]) returns []');
|
||||
t.deepEqual(chunk(123), [], 'chunk(123) returns []');
|
||||
t.deepEqual(chunk({ a: 123}), [], 'chunk({ a: 123}) returns []');
|
||||
t.deepEqual(chunk('string', 2), [ 'st', 'ri', 'ng' ], 'chunk(string, 2) returns [ st, ri, ng ]');
|
||||
t.throws(() => chunk(), 'chunk() throws an error');
|
||||
t.throws(() => chunk(undefined), 'chunk(undefined) throws an error');
|
||||
t.throws(() => chunk(null), 'chunk(null) throws an error');
|
||||
expect(typeof chunk === 'function').toBeTruthy();
|
||||
expect(chunk([1, 2, 3, 4, 5], 2)).toEqual([[1,2],[3,4],[5]]);
|
||||
expect(chunk([])).toEqual([]);
|
||||
expect(chunk(123)).toEqual([]);
|
||||
expect(chunk({ a: 123})).toEqual([]);
|
||||
expect(chunk('string', 2)).toEqual([ 'st', 'ri', 'ng' ]);
|
||||
expect(() => chunk()).toThrow();
|
||||
expect(() => chunk(undefined)).toThrow();
|
||||
expect(() => chunk(null)).toThrow();
|
||||
|
||||
let start = new Date().getTime();
|
||||
chunk('This is a string', 2);
|
||||
let end = new Date().getTime();
|
||||
t.true((end - start) < 2000, 'chunk(This is a string, 2) takes less than 2s to run');
|
||||
t.end();
|
||||
expect((end - start) < 2000).toBeTruthy();
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user