import { expect } from 'chai' import u, { typeOf } from '../src/index.js' import { of } from 'rxjs' import EE from 'events' console.log(of) describe('Type Check Library - ', function () { it('Should include custom types: buffer,promise,observable,emitter,async', function () { const emitter = new EE() const asyncfunc = async function () { } expect(u.isBuffer(Buffer.from('this is a test'))).to.equal(true) expect(u.getType(Buffer.from('this is a test'))).to.equal('buffer') expect(u.isPromise(Promise.resolve(2))).to.equal(true) expect(u.getType(Promise.resolve(2))).to.equal('promise') expect(u.isObservable(of(1, 2, 3))).to.equal(true) expect(u.getType(of(1, 2, 3))).to.equal('observable') expect(u.isEmitter(emitter)).to.equal(true) expect(u.getType(emitter)).to.equal('emitter') expect(u.isAsync(asyncfunc)).to.equal(true) expect(u.getType(asyncfunc)).to.equal('async') }) it('Should export typeOf for .getType', function () { expect(typeOf(typeOf)).to.equal('function') }) console.log(typeOf(typeOf)) it('Should include base typechecker methods', function () { expect(u.isPlainObject([1])).to.equal(false) expect(u.isPlainObject({ test: 'test' })).to.equal(true) expect(u.getType(true)).to.equal('boolean') expect(u.getObjectType('a string')).to.equal('[object String]') expect(u.getType('this is a test')).to.equal('string') }) })