FrontendAtlas
Study
▾
Dashboard
Pricing
Get full access
</> Code
Test cases
Language
JavaScript
TypeScript
export default function sleep(ms) { // TODO: return a Promise that resolves after ms milliseconds throw new Error('Not implemented'); }
import sleep from './file'; describe('sleep', () => { test('returns a promise', () => { const p = sleep(1); expect(p && typeof p.then).toBe('function'); }); test('resolves after at least the delay', async () => { const start = Date.now(); await sleep(25); const elapsed = Date.now() - start; expect(elapsed >= 20).toBe(true); }); });
▶ Run tests
Results
Console
Run tests to see results.