Skip to content

armgit / cindy

Public Imported from GitHub
0

Consider it done. The open-source AI agent that works out of the box · 想到,就能做到。开源、开箱即用的 AI Agent。

774 B
Raw Blame
import { afterEach, expect, it, vi } from "vitest";
import { setMobileDebugSink } from "@/debug/mobileDebugLog";
import { connectionDiagnostics } from "../connectionDiagnostics";
afterEach(() => setMobileDebugSink(undefined));
it("records elapsed milestones once and ignores callbacks after stop", () => {
  const sink = vi.fn();
  setMobileDebugSink(sink);
  let now = 100;
  const mark = connectionDiagnostics(2, () => now);
  mark("connect");
  now = 150;
  mark("screenshot-presented");
  mark("screenshot-presented");
  now = 190;
  mark("stopped");
  mark("video-presented");
  expect(sink).toHaveBeenCalledTimes(3);
  expect(JSON.stringify(sink.mock.calls)).toContain('"elapsedMs":50');
  expect(JSON.stringify(sink.mock.calls)).not.toContain("video-presented");
});