Syntax previewClick to edit
1234
export default function isEmpty(obj) {
throw new Error('Not implemented');
}
Syntax previewClick to edit
12345678910111213141516171819202122232425
import isEmpty from './file';
describe('isEmpty', () => {
test('returns false for non-empty object', () => {
expect(isEmpty({ x: 5, y: 42 })).toBe(false);
});
test('returns true for empty object', () => {
expect(isEmpty({})).toBe(true);
});
test('returns false for non-empty array', () => {
expect(isEmpty([null, false, 0])).toBe(false);
});
test('returns true for empty array', () => {
expect(isEmpty([])).toBe(true);
});
test('throws TypeError for non-object/array inputs', () => {
expect(() => isEmpty(42)).toThrow(TypeError);
expect(() => isEmpty('foo')).toThrow(TypeError);
});
});
Run tests to see results.