Files

24 lines
774 B
TypeScript
Raw Permalink Normal View History

2026-10-05 18:10:18 -04:00
import { describe, expect, it } from 'vitest';
import { isObject } from '@/lib/objects';
2026-10-08 16:53:20 -04:00
describe('@/lib/objects.ts', () => {
describe('isObject()', () => {
it('should return true for objects', () => {
expect(isObject({})).toBe(true);
expect(isObject({ foo: 123 })).toBe(true);
expect(isObject(Object.freeze({}))).toBe(true);
});
2026-10-08 16:53:20 -04:00
it('should return false for null', () => {
expect(isObject(null)).toBe(false);
});
it.each([undefined, 123, 'foobar', () => ({}), Function, String(123), isObject, () => null, [], [1, 2, 3]])(
'should return false for %p',
2026-10-08 16:53:20 -04:00
(value) => {
expect(isObject(value)).toBe(false);
}
);
});
});