mirror of
https://github.com/usebruno/bruno.git
synced 2026-07-07 14:08:38 +00:00
refactor(AI): remove platform modifier key mock (#8496)
This commit is contained in:
@@ -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', () => {
|
||||
|
||||
Reference in New Issue
Block a user