@schukai/monster
Version:
Monster is a simple library for creating fast, robust and lightweight websites.
48 lines (36 loc) • 1.12 kB
JavaScript
import {Stack} from "../../../source/types/stack.mjs";
import {
typeOf
} from "../../../source/types/typeof.mjs"
import {expect} from "chai"
describe('typeOf', function () {
describe('.typeOf()', function () {
[
[true, 'boolean'],
[null, 'null'],
[undefined, 'undefined'],
[Promise.resolve(), 'promise'],
[new WeakMap(), 'weakmap'],
[new Map(), 'map'],
[NaN, 'number'],
[function* () {
}, 'generatorfunction'],
[5, 'number'],
[function () {
}, 'function'],
[/a/, 'regexp'],
[new Date(), 'date'],
[{}, 'object'],
[[], 'array'],
['', 'string'],
[new Error, 'error'],
[new Stack, 'stack']
].forEach(function (data) {
let a = data.shift()
let b = data.shift()
it('should return ' + b + ' when the value ' + typeOf(a), function () {
expect(typeOf(a)).to.be.equal(b);
});
});
});
});