Files
AgentHub/client/src/lib/__tests__/remoteDataEvents.test.ts
T
nntrivi2001 57dc91585d feat: Claude Code Monitor — lanes, pipelines and a merged workspace
Internal SmartGift build of a Claude Code monitoring dashboard.

Lanes: a durable unit of parallel agent work, one per working directory,
tracked across session restarts. Managed lanes are git worktrees the
dashboard provisions and can reset or remove behind a three-check destroy
guard and a counted preflight; adopted lanes are directories you already
own and are never destroyable.

Pipelines: a lane moves through pipeline stages. A stage the agent declares
with evidence renders green; a stage inferred from the tool-event stream
renders dashed amber and never counts as done. Detection is forward-only
within a 30-minute window, and never writes the declared stage.

Workspace: one page at /run with a lane grid, the selected lane's pipeline,
and a full Claude console behind a disclosure.
2026-07-30 14:39:03 +07:00

62 lines
1.7 KiB
TypeScript

/**
* @file Tests for remote-data WebSocket refresh helpers.
* @author Nguyễn Ngọc Trí Vĩ <vinnt@smartgift.vn>
*/
import { describe, expect, it } from "vitest";
import { isRemoteDataRefreshMessage } from "../remoteDataEvents";
import type { ImportProgressMessage, WSMessage } from "../types";
function msg(type: WSMessage["type"], data: WSMessage["data"]): WSMessage {
return { type, data, timestamp: "2026-01-01T00:00:00.000Z" };
}
describe("isRemoteDataRefreshMessage", () => {
it("returns true for remote_data.updated", () => {
expect(
isRemoteDataRefreshMessage(
msg("remote_data.updated", {
sourceId: "src_1",
source: "src_1",
})
)
).toBe(true);
});
it("returns true when remote_source.status is ok", () => {
expect(
isRemoteDataRefreshMessage(msg("remote_source.status", { id: "src_1", status: "ok" }))
).toBe(true);
});
it("returns false when remote_source.status is syncing", () => {
expect(
isRemoteDataRefreshMessage(msg("remote_source.status", { id: "src_1", status: "syncing" }))
).toBe(false);
});
it("returns true for remote import.progress complete", () => {
expect(
isRemoteDataRefreshMessage(
msg("import.progress", {
phase: "complete",
source: "remote",
importId: "remote-src_1",
} as ImportProgressMessage)
)
).toBe(true);
});
it("returns false for local import.progress complete", () => {
expect(
isRemoteDataRefreshMessage(
msg("import.progress", {
phase: "complete",
source: "default",
importId: "x",
} as ImportProgressMessage)
)
).toBe(false);
});
});