@qntm-code/utils
Version:
A collection of useful utility functions with associated TypeScript types. All functions have been unit tested.
76 lines (75 loc) • 3 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
const isNaNStrict_1 = require("./isNaNStrict");
describe(`isNanStrict`, () => {
it(`should return true if value is NaN`, () => {
const value = NaN;
expect((0, isNaNStrict_1.isNaNStrict)(value)).toBeTrue();
});
it('should return false if value is null', () => {
const value = null;
expect((0, isNaNStrict_1.isNaNStrict)(value)).toBe(false);
});
it('should return false if value is undefined', () => {
const value = undefined;
expect((0, isNaNStrict_1.isNaNStrict)(value)).toBe(false);
});
it('should return false if value is a boolean', () => {
const value = true;
expect((0, isNaNStrict_1.isNaNStrict)(value)).toBe(false);
});
it('should return false if value is a string', () => {
const value = 'no';
expect((0, isNaNStrict_1.isNaNStrict)(value)).toBe(false);
});
it('should return false if value is a object', () => {
const value = {};
expect((0, isNaNStrict_1.isNaNStrict)(value)).toBe(false);
});
it('should return false if value is an Array', () => {
const value = [];
expect((0, isNaNStrict_1.isNaNStrict)(value)).toBe(false);
});
it('should return false if value is a date', () => {
const value = new Date();
expect((0, isNaNStrict_1.isNaNStrict)(value)).toBe(false);
});
it('should return false if value is a Map', () => {
const value = new Map();
expect((0, isNaNStrict_1.isNaNStrict)(value)).toBe(false);
});
it('should return false if value is a Set', () => {
const value = new Set();
expect((0, isNaNStrict_1.isNaNStrict)(value)).toBe(false);
});
it('should return false if value is a WeakMap', () => {
const value = new WeakMap();
expect((0, isNaNStrict_1.isNaNStrict)(value)).toBe(false);
});
it('should return false if value is a WeakSet', () => {
const value = new WeakSet();
expect((0, isNaNStrict_1.isNaNStrict)(value)).toBe(false);
});
it('should return false if value is a function', () => {
const value = () => {
return;
};
expect((0, isNaNStrict_1.isNaNStrict)(value)).toBe(false);
});
it('should return false if value is a positive number', () => {
const value = 10;
expect((0, isNaNStrict_1.isNaNStrict)(value)).toBe(false);
});
it('should return false if value is a negative number', () => {
const value = -10;
expect((0, isNaNStrict_1.isNaNStrict)(value)).toBe(false);
});
it('should return false if value is a decimal', () => {
const value = 10.2;
expect((0, isNaNStrict_1.isNaNStrict)(value)).toBe(false);
});
it('should return false if value is a NaN as a string', () => {
const value = 'NaN';
expect((0, isNaNStrict_1.isNaNStrict)(value)).toBe(false);
});
});