Files
aiturk-hermes-ide/apps/desktop/src/app/settings/computer-use-panel.test.tsx
T

64 lines
2.0 KiB
TypeScript
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
import { cleanup, render, screen } from '@testing-library/react'
import { afterEach, describe, expect, it, vi } from 'vitest'
import { I18nProvider } from '@/i18n/context'
import { ComputerUsePanel } from './computer-use-panel'
const getStatus = vi.hoisted(() => vi.fn())
vi.mock('@/hermes', () => ({
getComputerUseStatus: getStatus,
getActionStatus: vi.fn(),
grantComputerUsePermissions: vi.fn()
}))
afterEach(() => {
cleanup()
vi.clearAllMocks()
})
describe('Computer Use localized permissions', () => {
it('renders macOS permission labels, explanations, and states in Turkish', async () => {
getStatus.mockResolvedValue({
platform: 'darwin',
platform_supported: true,
installed: true,
can_grant: true,
accessibility: true,
screen_recording: false,
ready: false,
checks: []
})
render(
<I18nProvider configClient={null} initialLocale="tr">
<ComputerUsePanel />
</I18nProvider>
)
expect(await screen.findByText('Erişilebilirlik')).toBeTruthy()
expect(screen.getByText('Ekran Kaydı')).toBeTruthy()
expect(screen.getByText('İzin verildi')).toBeTruthy()
expect(screen.getByText('İzin verilmedi')).toBeTruthy()
expect(screen.getByText(/uygulama pencerelerinin ekran görüntüsünü/)).toBeTruthy()
expect(screen.getByRole('button', { name: 'İzinleri ver' })).toBeTruthy()
})
it('retains English and represents a ready Windows driver without macOS permission controls', async () => {
getStatus.mockResolvedValue({
platform: 'win32',
platform_supported: true,
installed: true,
can_grant: false,
ready: true,
checks: []
})
render(
<I18nProvider configClient={null} initialLocale="en">
<ComputerUsePanel />
</I18nProvider>
)
expect(await screen.findByText('Driver health')).toBeTruthy()
expect(screen.getByText('Ready')).toBeTruthy()
expect(screen.queryByRole('button', { name: 'Grant permissions' })).toBeNull()
})
})