21 lines
710 B
JavaScript
21 lines
710 B
JavaScript
import { expect } from 'chai'
|
|
import u from '../src/type'
|
|
|
|
describe('Variable Types Library - ', function () {
|
|
|
|
it('Should include custom types', 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')
|
|
})
|
|
|
|
it('Should load typechecker', function () {
|
|
expect(u.isPlainObject([1])).to.equal(false)
|
|
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')
|
|
})
|
|
|
|
})
|