Add contracts coverage for sync engine mode in server config
Co-authored-by: Julius Marminge <[email protected]>
This commit is contained in:
1 parent
24dbfa58c9
commit
04f3546c06
1 file changed
+45
@@ -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();
|
||||
});
|
||||
});
|
||||
Reference in new issue
Block a user