FrontendAtlas
Study
▾
Dashboard
Pricing
Get full access
</> Code
Test cases
Language
JavaScript
TypeScript
export default function isEmpty(obj) { throw new Error('Not implemented'); }
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
Results
Console
Run tests to see results.