Skip to content

Commit ca0f252

Browse files
committed
test: raise DCG setting patch coverage
1 parent 76a1dae commit ca0f252

3 files changed

Lines changed: 16 additions & 1 deletion

File tree

src/core/webview/ClineProvider.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2461,7 +2461,7 @@ export class ClineProvider
24612461
alwaysAllowWriteOutsideWorkspace: alwaysAllowWriteOutsideWorkspace ?? false,
24622462
alwaysAllowWriteProtected: alwaysAllowWriteProtected ?? false,
24632463
alwaysAllowExecute: alwaysAllowExecute ?? false,
2464-
destructiveCommandGuardEnabled: destructiveCommandGuardEnabled ?? DEFAULT_DESTRUCTIVE_COMMAND_GUARD_ENABLED,
2464+
destructiveCommandGuardEnabled,
24652465
alwaysAllowMcp: alwaysAllowMcp ?? false,
24662466
alwaysAllowModeSwitch: alwaysAllowModeSwitch ?? false,
24672467
alwaysAllowSubtasks: alwaysAllowSubtasks ?? false,

src/core/webview/__tests__/ClineProvider.spec.ts

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1011,6 +1011,14 @@ describe("ClineProvider", () => {
10111011
expect(state).toHaveProperty("writeDelayMs")
10121012
})
10131013

1014+
test("getState returns the saved destructive command guard setting", async () => {
1015+
await provider.contextProxy.setValue("destructiveCommandGuardEnabled", true)
1016+
1017+
const state = await provider.getState()
1018+
1019+
expect(state.destructiveCommandGuardEnabled).toBe(true)
1020+
})
1021+
10141022
test("getStateToPostToWebview returns the saved destructive command guard setting", async () => {
10151023
await provider.resolveWebviewView(mockWebviewView)
10161024
await provider.contextProxy.setValue("destructiveCommandGuardEnabled", true)

webview-ui/src/components/settings/__tests__/AutoApproveSettings.spec.tsx

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -154,4 +154,11 @@ describe("AutoApproveSettings - Save/Discard contract", () => {
154154
expect(screen.queryByTestId("allowed-commands-heading")).not.toBeInTheDocument()
155155
expect(screen.queryByTestId("denied-commands-heading")).not.toBeInTheDocument()
156156
})
157+
158+
it("shows Zoo command list editors while destructive command guard is disabled", () => {
159+
renderSettings({ destructiveCommandGuardEnabled: false })
160+
161+
expect(screen.getByTestId("allowed-commands-heading")).toBeInTheDocument()
162+
expect(screen.getByTestId("denied-commands-heading")).toBeInTheDocument()
163+
})
157164
})

0 commit comments

Comments
 (0)