session-timeline-stream-probe.test.ts 806 B

1234567891011121314
  1. import { expect, test } from "bun:test"
  2. import { streamChunk } from "../timeline/session-timeline-benchmark.fixture"
  3. import { streamProgress } from "../timeline/session-timeline-stream-probe"
  4. test("classifies emitted stream markers using the fixture cycle", () => {
  5. expect(streamProgress("before stream-17 after stream-18")).toEqual({ index: 18, phase: "boundary" })
  6. expect(streamProgress("before stream-18 after stream-19")).toEqual({ index: 19, phase: "stream" })
  7. expect(streamProgress("benchmark-complete stream-36")).toEqual({ index: 36, phase: "complete" })
  8. expect(streamProgress("no marker")).toEqual({ index: -1, phase: "unknown" })
  9. })
  10. test("emits progress markers at fixture boundaries", () => {
  11. expect(streamProgress(streamChunk(18, 160))).toEqual({ index: 18, phase: "boundary" })
  12. })