refactor(AI): remove platform modifier key mock (#8496)

This commit is contained in:
naman-bruno
2026-07-06 18:36:31 +05:30
committed by GitHub
parent 732356b7c0
commit 153f0cd91f

View File

@@ -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', () => {