/* eslint-disable no-empty-function */ import { t, typeAsserts, Validator } from '../../index'; describe('any,unknown,as', () => { function testSchema(schema: Validator) { expect(schema.validate('')).toBe(true); expect(schema.validate('str')).toBe(true); expect(() => { typeAsserts(schema, 'str'); }).not.toThrow(); expect(schema.validate(1)).toBe(true); expect(() => { typeAsserts(schema, 1); }).not.toThrow(); expect(schema.validate(Symbol.for('1'))).toBe(true); expect(() => { typeAsserts(schema, Symbol.for('1')); }).not.toThrow(); expect(schema.validate(null)).toBe(true); expect(() => { typeAsserts(schema, null); }).not.toThrow(); expect(schema.validate(undefined)).toBe(true); expect(() => { typeAsserts(schema, undefined); }).not.toThrow(); expect(schema.validate({})).toBe(true); expect(() => { typeAsserts(schema, {}); }).not.toThrow(); expect(schema.validate([])).toBe(true); expect(() => { typeAsserts(schema, []); }).not.toThrow(); expect(schema.validate(() => {})).toBe(true); expect(() => { typeAsserts(schema, () => {}); }).not.toThrow(); expect(schema.validate(BigInt(1))).toBe(true); expect(() => { typeAsserts(schema, BigInt(1)); }).not.toThrow(); } it('any', () => { expect.hasAssertions(); testSchema(t.any()); }); it('unknown', () => { expect.hasAssertions(); testSchema(t.unknown()); }); it('as', () => { expect.hasAssertions(); testSchema(t.as()); }); });