Add contracts coverage for sync engine mode in server config

Co-authored-by: Julius Marminge <[email protected]>
This commit is contained in:
Cursor AgentandJulius Marminge committed 2026-02-20 12:06:37 +00:00
1 parent 24dbfa58c9
commit 04f3546c06
1 file changed
+45
+45
View File
@@ -0,0 +1,45 @@
import { describe, expect, it } from "vitest";
import { serverConfigSchema } from "./server";
describe("serverConfigSchema", () => {
it("defaults syncEngineMode to legacy when omitted", () => {
expect(
serverConfigSchema.parse({
cwd: "/workspace",
keybindings: [],
}),
).toEqual({
cwd: "/workspace",
syncEngineMode: "legacy",
keybindings: [],
});
});
it("accepts supported sync engine modes", () => {
expect(
serverConfigSchema.parse({
cwd: "/workspace",
syncEngineMode: "livestore-read-pilot",
keybindings: [],
}).syncEngineMode,
).toBe("livestore-read-pilot");
expect(
serverConfigSchema.parse({
cwd: "/workspace",
syncEngineMode: "shadow",
keybindings: [],
}).syncEngineMode,
).toBe("shadow");
});
it("rejects unsupported sync engine mode values", () => {
expect(() =>
serverConfigSchema.parse({
cwd: "/workspace",
syncEngineMode: "livestore",
keybindings: [],
}),
).toThrow();
});
});