Download packages/schema/test/legacy-event.test.ts from SaylorTwift/opencode: direct link, hf CLI and curl.
- Browser
- Download file 1.74 kB
-
https://huggingface.co/SaylorTwift/opencode/resolve/main/packages/schema/test/legacy-event.test.ts
- Command line
-
hf download hf://SaylorTwift/opencode/packages/schema/test/legacy-event.test.ts
-
curl -L -o legacy-event.test.ts https://huggingface.co/SaylorTwift/opencode/resolve/main/packages/schema/test/legacy-event.test.ts
1.74 kB
| import { describe, expect, test } from "bun:test" | |
| import { LegacyEvent } from "../src/legacy-event" | |
| import { PermissionV1 } from "../src/permission-v1" | |
| import { QuestionV1 } from "../src/question-v1" | |
| import { Project } from "../src/project" | |
| import { SessionV1 } from "../src/session-v1" | |
| describe("legacy public event schemas", () => { | |
| test("owns all SessionV1 definitions", () => { | |
| expect(SessionV1.Event.Definitions.map((event) => event.type)).toEqual([ | |
| "session.created", | |
| "session.updated", | |
| "session.deleted", | |
| "message.updated", | |
| "message.removed", | |
| "message.part.updated", | |
| "message.part.removed", | |
| "message.part.delta", | |
| "session.diff", | |
| "session.error", | |
| ]) | |
| const durable = SessionV1.Event.Definitions.filter((event) => event.durable !== undefined) | |
| expect(durable).toHaveLength(7) | |
| expect(durable.every((event) => event.durable?.aggregate === "sessionID")).toBe(true) | |
| expect(durable.every((event) => event.durable?.version === 1)).toBe(true) | |
| }) | |
| test("owns the legacy transient public definitions", () => { | |
| expect([ | |
| SessionV1.PartDelta.type, | |
| SessionV1.Diff.type, | |
| SessionV1.Error.type, | |
| PermissionV1.Event.Asked.type, | |
| PermissionV1.Event.Replied.type, | |
| QuestionV1.Event.Asked.type, | |
| QuestionV1.Event.Replied.type, | |
| QuestionV1.Event.Rejected.type, | |
| Project.Event.Updated.type, | |
| LegacyEvent.CommandExecuted.type, | |
| ]).toEqual([ | |
| "message.part.delta", | |
| "session.diff", | |
| "session.error", | |
| "permission.asked", | |
| "permission.replied", | |
| "question.asked", | |
| "question.replied", | |
| "question.rejected", | |
| "project.updated", | |
| "command.executed", | |
| ]) | |
| }) | |
| }) | |