1
1
mirror of https://github.com/pterodactyl/panel.git synced 2024-11-26 02:52:30 +01:00
Pterodactyl-Panel/resources/scripts/lib/objects.spec.ts
2022-11-25 13:25:03 -07:00

25 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);
},
);
});
});