Delay

intermediate5 of 6

Learn about delay in fp-ts task

Code Editor

05-delay.exercise.ts

💻
Loading editor...
Preparing Monaco Editor with TypeScript support

Test Results

Requirements

describe('Task delay', () => {
  it('delays execution', async () => {
    const start = Date.now()
    await delay(20)()
    const duration = Date.now() - start
    expect(duration).toBeGreaterThanOrEqual(15)
  })

  it('delays computation', async () => {
    const start = Date.now()
    const result = await delayedComputation('done', 20)()
    const duration = Date.now() - start

    expect(result).toBe('done')
    expect(duration).toBeGreaterThanOrEqual(15)
  })
})
🧪

Ready to Test?

Click "Run Tests" to see how your code performs

Pro Tips

💡 Stuck? Here's what to try:

  • • Read the comments in the code carefully
  • • Run tests frequently to get feedback
  • • Check the fp-ts documentation
  • • Use the solution if you need help

🚀 Learning Approach:

  • • Focus on understanding, not just solving
  • • Experiment with different approaches
  • • Think about real-world applications
  • • Build on previous exercises