Skip to content

Commit 76a1dae

Browse files
committed
test: cover DCG global setting schema
1 parent f7ae3cb commit 76a1dae

1 file changed

Lines changed: 22 additions & 0 deletions

File tree

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
import {
2+
DEFAULT_DESTRUCTIVE_COMMAND_GUARD_ENABLED,
3+
GLOBAL_SETTINGS_KEYS,
4+
globalSettingsSchema,
5+
} from "../global-settings.js"
6+
7+
describe("destructive command guard global setting", () => {
8+
it("is opt-in by default", () => {
9+
expect(DEFAULT_DESTRUCTIVE_COMMAND_GUARD_ENABLED).toBe(false)
10+
})
11+
12+
it("accepts and exposes the persisted setting", () => {
13+
expect(globalSettingsSchema.parse({ destructiveCommandGuardEnabled: true })).toEqual({
14+
destructiveCommandGuardEnabled: true,
15+
})
16+
expect(GLOBAL_SETTINGS_KEYS).toContain("destructiveCommandGuardEnabled")
17+
})
18+
19+
it("rejects non-boolean setting values", () => {
20+
expect(() => globalSettingsSchema.parse({ destructiveCommandGuardEnabled: "true" })).toThrow()
21+
})
22+
})

0 commit comments

Comments
 (0)