Menu
popagent
publicLatest change 7f0ff66d6d9fb6468416c58bee46bd3d08169501 - Checkpoint browser channels and memory work by AkurAI Build
import { describe, expect, test } from "bun:test";
import { parseChannelEventBlock } from "./channel-stream";
describe("channel event stream parser", () => {
test("parses channel events and ignores comments or malformed data", () => {
expect(parseChannelEventBlock(": heartbeat")).toBeUndefined();
expect(parseChannelEventBlock("data: nope")).toBeUndefined();
expect(parseChannelEventBlock('id: 1\nevent: channel\ndata: {"id":"1","channelId":"general","type":"task","messageId":null,"taskId":"t1","taskStatus":"running","createdAt":"now"}')).toMatchObject({
channelId: "general",
taskId: "t1",
taskStatus: "running",
});
});
});