From 1a4fbbf2b356a948394099a6f342afde1df41980 Mon Sep 17 00:00:00 2001 From: mkorwel Date: Sat, 14 Mar 2026 12:24:04 -0700 Subject: [PATCH] chore: move policy visual tests to core fixes PR --- .../test-utils/fixtures/policy-test.responses | 1 - packages/cli/src/ui/PolicyVisual.test.tsx | 76 ------------------- 2 files changed, 77 deletions(-) delete mode 100644 packages/cli/src/test-utils/fixtures/policy-test.responses delete mode 100644 packages/cli/src/ui/PolicyVisual.test.tsx diff --git a/packages/cli/src/test-utils/fixtures/policy-test.responses b/packages/cli/src/test-utils/fixtures/policy-test.responses deleted file mode 100644 index d628783bf8..0000000000 --- a/packages/cli/src/test-utils/fixtures/policy-test.responses +++ /dev/null @@ -1 +0,0 @@ -{"method":"generateContentStream","response":[{"candidates":[{"content":{"role":"model","parts":[{"text":"I am going to read the secret file."},{"functionCall":{"name":"read_file","args":{"file_path":"secret.txt"}}}]},"finishReason":"STOP"}]}]} diff --git a/packages/cli/src/ui/PolicyVisual.test.tsx b/packages/cli/src/ui/PolicyVisual.test.tsx deleted file mode 100644 index 8a0cdc4308..0000000000 --- a/packages/cli/src/ui/PolicyVisual.test.tsx +++ /dev/null @@ -1,76 +0,0 @@ -/** - * @license - * Copyright 2026 Google LLC - * SPDX-License-Identifier: Apache-2.0 - */ - -import { describe, it, expect, beforeEach, afterEach } from 'vitest'; -import { AppRig } from '../test-utils/AppRig.js'; -import { PolicyDecision } from '@google/gemini-cli-core'; -import path from 'node:path'; -import { fileURLToPath } from 'node:url'; - -const __dirname = path.dirname(fileURLToPath(import.meta.url)); - -describe('Policy Engine Visual Validation', () => { - let rig: AppRig; - - beforeEach(async () => { - const fakeResponsesPath = path.join( - __dirname, - '../test-utils/fixtures/policy-test.responses', - ); - rig = new AppRig({ - fakeResponsesPath, - }); - await rig.initialize(); - }); - - afterEach(async () => { - await rig.unmount(); - }); - - it('should boot correctly and display the main interface', async () => { - rig.render(); - await rig.waitForIdle(); - expect(rig.lastFrame).toContain('Type your message'); - }); - - it.todo( - 'should visually render a DENY decision when a tool is blocked', - async () => { - rig.setToolPolicy('read_file', PolicyDecision.DENY); - rig.render(); - - await rig.sendMessage('Read secret.txt'); - - // Wait for the model's initial text response - await rig.waitForOutput(/I am going to read the secret file/i); - - // Wait for the blocked message to appear - await rig.waitForOutput(/Blocked by policy/i); - - // Verify it matches the SVG snapshot - await expect(rig).toMatchSvgSnapshot(); - }, - ); - - it.todo( - 'should visually render an ASK_USER prompt for policy approval', - async () => { - rig.setToolPolicy('read_file', PolicyDecision.ASK_USER); - rig.render(); - - await rig.sendMessage('Read secret.txt'); - - // Wait for the model's initial text response - await rig.waitForOutput(/I am going to read the secret file/i); - - // Wait for the confirmation prompt - await rig.waitForOutput(/Allow execution/i); - - // Verify it matches the SVG snapshot - await expect(rig).toMatchSvgSnapshot(); - }, - ); -});