ts-prime
Version:
A utility library for JavaScript and Typescript.
35 lines (34 loc) • 1.32 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
var type_1 = require("./type");
it('"Array" if given an array literal', function () {
expect(type_1.type([1, 2, 3])).toEqual('Array');
});
it('"Object" if given an object literal', function () {
expect(type_1.type({ batman: 'na na na na na na na' })).toEqual('Object');
});
it('"RegExp" if given a RegExp literal', function () {
expect(type_1.type(/[A-z]/)).toEqual('RegExp');
});
it('"Number" if given a numeric value', function () {
expect(type_1.type(4)).toEqual('Number');
});
it('"Object" if given a date value', function () {
expect(type_1.type(new Date())).toEqual('Date');
});
it('"Number" if given the NaN value', function () {
expect(type_1.type(NaN)).toEqual('Number');
});
it('"String" if given a String literal', function () {
expect(type_1.type('Gooooodd Mornning a!!')).toEqual('String');
});
it('"String" if given a String object', function () {
// tslint:disable-next-line:no-construct
expect(type_1.type(new String('I am a String object'))).toEqual('String');
});
it('"Null" if given the null value', function () {
expect(type_1.type(null)).toEqual('Null');
});
it('"Undefined" if given the undefined value', function () {
expect(type_1.type(undefined)).toEqual('Undefined');
});