/* eslint-disable no-empty-function */ import { echo, getType } from '../../validate'; describe('validate utils', () => { it('getType', () => { expect.hasAssertions(); expect(getType(undefined)).toBe('undefined'); expect(getType(null)).toBe('null'); expect(getType(Symbol.for(''))).toBe('symbol'); expect(getType(1)).toBe('number'); expect(getType(BigInt('11111'))).toBe('bigint'); expect(getType('str')).toBe('string'); expect(getType({})).toBe('object'); expect(getType([])).toBe('array'); expect(getType(() => {})).toBe('function'); expect(getType(async () => {})).toBe('function'); expect(getType(function* () {})).toBe('function'); // eslint-disable-next-line @typescript-eslint/no-extraneous-class expect(getType(class {})).toBe('function'); }); it('echo has a(n)', () => { expect.hasAssertions(); expect(echo({})).toBe(`a(n) object`); expect(echo([])).toBe(`a(n) array`); expect(echo(BigInt('123'))).toBe('a(n) bigint'); expect(echo(() => {})).toBe(`a(n) function`); expect(echo(Symbol.for('abc'))).toBe(`a(n) symbol`); }); it('echo no a(n)', () => { expect.hasAssertions(); expect(echo('1')).toBe(`"1"`); expect(echo(1)).toBe(`1`); expect(echo(null)).toBe(`null`); expect(echo(undefined)).toBe(`undefined`); expect(echo(true)).toBe('true'); expect(echo(false)).toBe('false'); }); });