renovate/lib/util/object.spec.ts

18 lines
463 B
TypeScript
Raw Normal View History

2020-11-24 10:09:40 +00:00
import { hasKey } from './object';
describe('util/object', () => {
2020-11-24 10:09:40 +00:00
beforeEach(() => {
jest.resetModules();
});
it('finds key in regular object', () => {
expect(hasKey('foo', { foo: true })).toBeTrue();
});
it('detects missing key in regular object', () => {
expect(hasKey('foo', { bar: true })).toBeFalse();
});
it('returns false for wrong instance type', () => {
expect(hasKey('foo', 'i-am-not-an-object')).toBeFalse();
});
});