mirror of
https://github.com/tenrok/OverlayScrollbars.git
synced 2026-06-10 08:42:26 +03:00
32 lines
757 B
TypeScript
32 lines
757 B
TypeScript
import { keys, hasOwnProperty } from 'support/utils/object';
|
|
|
|
describe('object utilities', () => {
|
|
describe('keys', () => {
|
|
test('correct amount of keys', () => {
|
|
const obj = {
|
|
a: 1,
|
|
b: 2,
|
|
c: 3,
|
|
};
|
|
expect(keys(obj)).toEqual(Object.keys(obj));
|
|
});
|
|
|
|
test('empty array if object null or undefined', () => {
|
|
expect(keys(undefined)).toEqual([]);
|
|
expect(keys(null)).toEqual([]);
|
|
});
|
|
});
|
|
|
|
test('hasOwnProperty', () => {
|
|
const obj = {
|
|
a: 1,
|
|
b: 2,
|
|
c: 3,
|
|
};
|
|
expect(hasOwnProperty(obj, 'a')).toBe(true);
|
|
expect(hasOwnProperty(obj, 'b')).toBe(true);
|
|
expect(hasOwnProperty(obj, 'c')).toBe(true);
|
|
expect(hasOwnProperty(obj, 'd')).toBe(false);
|
|
});
|
|
});
|