Skip to content

Add unit tests for StreamingQueue utility class #15

Description

@kanweiwei

The StreamingQueue class (web/src/utils/streaming-queue.ts, 92 lines) has no tests.

It's a self-contained class with add(), flushNow(), and destroy() methods that batches streaming text updates using requestAnimationFrame.

What to do:

  1. Read web/src/utils/streaming-queue.ts to understand the API
  2. Create web/src/utils/__tests__/streaming-queue.test.ts
  3. Test cases to cover:
    • add() queues items and flushNow() delivers them
    • destroy() stops further processing
    • Empty queue behavior
    • Multiple adds before flush
  4. Mock requestAnimationFrame in tests (or just test via flushNow())
  5. Run: pnpm -C web run test -- --run streaming-queue

Skills needed: TypeScript, Vitest

Estimated time: 1 hour

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions