From 153f0cd91f17fd6ef32d84c419f293f9649c9b76 Mon Sep 17 00:00:00 2001 From: naman-bruno Date: Mon, 6 Jul 2026 18:36:31 +0530 Subject: [PATCH] refactor(AI): remove platform modifier key mock (#8496) --- .../src/components/AIAssist/index.spec.js | 15 ++------------- 1 file changed, 2 insertions(+), 13 deletions(-) diff --git a/packages/bruno-app/src/components/AIAssist/index.spec.js b/packages/bruno-app/src/components/AIAssist/index.spec.js index 702e7b9cf..419c916a0 100644 --- a/packages/bruno-app/src/components/AIAssist/index.spec.js +++ b/packages/bruno-app/src/components/AIAssist/index.spec.js @@ -5,7 +5,6 @@ import { Provider } from 'react-redux'; import { configureStore } from '@reduxjs/toolkit'; import { ThemeProvider } from 'styled-components'; import { aiGenerateScript, stopAiGeneration } from 'utils/ai'; -import { getPlatformModifierKey } from 'utils/common/platform'; import AIAssist from './index'; jest.mock('utils/ai', () => ({ @@ -13,11 +12,6 @@ jest.mock('utils/ai', () => ({ stopAiGeneration: jest.fn() })); -jest.mock('utils/common/platform', () => ({ - ...jest.requireActual('utils/common/platform'), - getPlatformModifierKey: jest.fn() -})); - const theme = { bg: '#1e1e1e', text: '#ffffff', @@ -69,7 +63,6 @@ describe('AIAssist', () => { beforeEach(() => { jest.clearAllMocks(); aiGenerateScript.mockResolvedValue({ content: 'test("generated", () => {});' }); - getPlatformModifierKey.mockReturnValue('Ctrl'); }); describe('visibility', () => { @@ -166,15 +159,11 @@ describe('AIAssist', () => { expect(screen.queryByRole('button', { name: 'Status 200' })).not.toBeInTheDocument(); }); - it.each([ - ['macOS', '⌘'], - ['non-macOS', 'Ctrl'] - ])('shows the %s modifier in the generate shortcut hint', (_platform, modifier) => { - getPlatformModifierKey.mockReturnValue(modifier); + it('shows the generate shortcut hint', () => { renderAIAssist(); openPopup(); - expect(screen.getByText(`${modifier} + Enter to generate`)).toBeInTheDocument(); + expect(screen.getByText('Enter to generate · Shift+Enter for newline')).toBeInTheDocument(); }); it('keeps Generate disabled until the prompt has text', () => {