Open History to see the last commit
1import { describe, expect, it } from "@effect/vitest";
2import * as Schema from "effect/Schema";
3
4import { WorkflowRunsSubscribeInput, WorkflowRunsUpdate } from "./workflow.ts";
5
6const decodeUpdate = Schema.decodeUnknownSync(WorkflowRunsUpdate);
7const encodeInput = Schema.encodeSync(WorkflowRunsSubscribeInput);
8// The input of a server from before `changes`.
9const decodeOlderInput = Schema.decodeUnknownSync(Schema.Struct({}));
10
11describe("workflows.subscribe across versions", () => {
12 it("reads a whole list from a server that does not send changes", () => {
13 const list = { workflows: [], runs: [], questions: [] };
14 expect(decodeUpdate(list)).toEqual(list);
15 });
16
17 it("asks for changes in a way an older server ignores", () => {
18 expect(() => decodeOlderInput(encodeInput({ changes: true }))).not.toThrow();
19 });
20});