mirror of
https://github.com/getpaseo/paseo.git
synced 2026-11-06 08:24:46 +00:00
Share host-wide terminal observations across plugin surfaces and gate them on terminalCollection. Keep directory observations compatible, and carry creation time in worker v6 state so v5 terminals can drain with an unknown timestamp.
34 lines
1.2 KiB
TypeScript
34 lines
1.2 KiB
TypeScript
import { describe, expect, it } from "vitest";
|
|
import {
|
|
classifyTerminalWorkerProtocol,
|
|
TERMINAL_WORKER_PROTOCOL_VERSION,
|
|
} from "./terminal-worker-protocol.js";
|
|
|
|
describe("classifyTerminalWorkerProtocol", () => {
|
|
it("rejects the unreleased cell protocol without a draining adapter", () => {
|
|
expect(classifyTerminalWorkerProtocol(1, 2)).toBe("obsolete");
|
|
expect(classifyTerminalWorkerProtocol(2, 3)).toBe("obsolete");
|
|
expect(classifyTerminalWorkerProtocol(3, 4)).toBe("obsolete");
|
|
expect(classifyTerminalWorkerProtocol(4, 5)).toBe("obsolete");
|
|
});
|
|
it.each([
|
|
[6, "current"],
|
|
[5, "previous"],
|
|
[4, "obsolete"],
|
|
[-1, "obsolete"],
|
|
[7, "newer"],
|
|
// A version this daemon cannot read comes from a Paseo it does not know.
|
|
["6", "newer"],
|
|
[4.5, "newer"],
|
|
[Number.NaN, "newer"],
|
|
[undefined, "newer"],
|
|
])("a worker reporting %s to a daemon at 6 is %s", (reported, fit) => {
|
|
expect(classifyTerminalWorkerProtocol(reported, 6)).toBe(fit);
|
|
});
|
|
});
|
|
|
|
it("drains v5 terminals while v6 supplies creation timestamps", () => {
|
|
expect(TERMINAL_WORKER_PROTOCOL_VERSION).toBe(6);
|
|
expect(classifyTerminalWorkerProtocol(5)).toBe("previous");
|
|
});
|