Test migration to jest by hand

Apparently using regular expressions is way easier.
This commit is contained in:
Angelos Chalaris
2018-06-18 15:15:56 +03:00
parent 5df7098fac
commit a78f5db260
894 changed files with 5917 additions and 3607 deletions

View File

@ -0,0 +1,2 @@
const isPrimitive = val => !['object', 'function'].includes(typeof val) || val === null;
module.exports = isPrimitive;

View File

@ -0,0 +1,25 @@
const expect = require('expect');
const isPrimitive = require('./isPrimitive.js');
test('isPrimitive is a Function', () => {
expect(isPrimitive).toBeInstanceOf(Function);
});
t.true(isPrimitive(null), "isPrimitive(null) is primitive");
t.true(isPrimitive(undefined), "isPrimitive(undefined) is primitive");
t.true(isPrimitive('string'), "isPrimitive(string) is primitive");
t.true(isPrimitive(true), "isPrimitive(true) is primitive");
t.true(isPrimitive(50), "isPrimitive(50) is primitive");
t.true(isPrimitive('Hello'), "isPrimitive('Hello') is primitive");
t.true(isPrimitive(false), "isPrimitive(false) is primitive");
t.true(isPrimitive(Symbol()), "isPrimitive(Symbol()) is primitive");
t.false(isPrimitive([1, 2, 3]), "isPrimitive([1, 2, 3]) is not primitive");
t.false(isPrimitive({ a: 123 }), "isPrimitive({ a: 123 }) is not primitive");
let start = new Date().getTime();
isPrimitive({ a: 123
let end = new Date().getTime();
test('isPrimitive({ a: 123 }) takes less than 2s to run', () => {
expect((end - start) < 2000).toBeTruthy();
});