import { expect } from 'chai' import { isKeyof } from '../../../lib' describe('util -> support -> types -> isKeyof', () => { it('should return false for invalid key types', () => { expect(isKeyof(true, {})).to.be.false expect(isKeyof(1.5, {})).to.be.false }) it('should return true if the key is in the object', () => { const sym = Symbol('test') const obj = { foo: true, [sym]: 123, } expect(isKeyof('foo', obj)).to.be.true expect(isKeyof(sym, obj)).to.be.true }) it('should return false if the key is not in the object', () => { const sym = Symbol('test') const obj = { foo: true, [Symbol('test2')]: 123, } expect(isKeyof('bar', obj)).to.be.false expect(isKeyof(sym, obj)).to.be.false }) })