isPrimitive test, type, truthy/falsy, time test, message reformat

This commit is contained in:
King
2018-01-15 11:32:42 -05:00
parent f762f76464
commit 4e8eeee7f4

View File

@ -5,17 +5,20 @@ test('Testing isPrimitive', (t) => {
//For more information on all the methods supported by tape
//Please go to https://github.com/substack/tape
t.true(typeof isPrimitive === 'function', 'isPrimitive is a Function');
t.equal(isPrimitive(null), true, "passed value is primitive");
t.equal(isPrimitive(50), true, "passed value is primitive");
t.equal(isPrimitive('Hello'), true, "passed value is primitive");
t.equal(isPrimitive(false), true, "passed value is primitive");
t.equal(isPrimitive(Symbol()), true, "passed value is primitive");
t.equal(isPrimitive([]), false, "passed value is primitive");
//t.deepEqual(isPrimitive(args..), 'Expected');
//t.equal(isPrimitive(args..), 'Expected');
//t.false(isPrimitive(args..), 'Expected');
//t.throws(isPrimitive(args..), 'Expected');
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();
t.true((end - start) < 2000, 'isPrimitive({ a: 123 }) takes less than 2s to run');
t.end();
});