misc_pterodactyl-panel/resources/scripts/lib/objects.spec.ts
2022-11-25 13:25:03 -07:00

24 lines
784 B
TypeScript

import { describe, expect, it } from 'vitest';
import { isObject } from '@/lib/objects';
describe('@/lib/objects.ts', () => {
describe('isObject()', () => {
it('should return true for objects', () => {
expect(isObject({})).equals(true);
expect(isObject({ foo: 123 })).equals(true);
expect(isObject(Object.freeze({}))).equals(true);
});
it('should return false for null', () => {
expect(isObject(null)).equals(false);
});
it.each([undefined, 123, 'foobar', () => ({}), Function, String(123), isObject, () => null, [], [1, 2, 3]])(
'should return false for %p',
value => {
expect(isObject(value)).equals(false);
},
);
});
});