Separate encrypted reasoning from actual compaction, stop migration after native return, and retain full history and recent exchanges. Add typed settings, Gemini fallback, verified provider windows, bounded summaries and durable concurrent checkpoints. Validation: 245 bridge tests plus focused concurrency tests; 71 settings/connection tests; 66 supplementary tests; TypeScript checks; renderer and Electron bundles; real primary/native/fallback summary probes and 700K input acceptance.
47 lines
1.9 KiB
TypeScript
47 lines
1.9 KiB
TypeScript
import { cleanup, fireEvent, render, screen, within } from '@testing-library/react'
|
||
import { afterEach, describe, expect, it } from 'vitest'
|
||
|
||
import { I18nProvider } from '@/i18n/context'
|
||
import { TR_SURFACES } from '@/i18n/tr-surfaces'
|
||
|
||
import { decodeShareCode, shareCodeErrorText } from './share-code'
|
||
import { ShareControls } from './share-controls'
|
||
|
||
describe('ShareControls', () => {
|
||
afterEach(() => {
|
||
cleanup()
|
||
})
|
||
|
||
it.each([
|
||
['en', 'Import / export map'],
|
||
['tr', 'Haritayı içe / dışa aktar']
|
||
])('opens its dialog with a tooltip in %s', async (locale, title) => {
|
||
render(<I18nProvider configClient={null} initialLocale={locale}><ShareControls shareCode="map-code" /></I18nProvider>)
|
||
|
||
const trigger = screen.getByRole('button', { name: title })
|
||
|
||
fireEvent.pointerMove(trigger, { pointerType: 'mouse' })
|
||
expect((await screen.findByRole('tooltip')).textContent).toContain(title)
|
||
|
||
fireEvent.click(trigger)
|
||
|
||
const dialog = await screen.findByRole('dialog')
|
||
expect(within(dialog).getByRole('heading', { name: title })).toBeTruthy()
|
||
})
|
||
|
||
it('keeps an invalid pasted code editable and displays the Turkish decoder error', async () => {
|
||
render(<I18nProvider configClient={null} initialLocale="tr"><ShareControls onImport={code => {
|
||
try { decodeShareCode(code);
|
||
|
||
return null } catch (error) { return shareCodeErrorText(error, TR_SURFACES.mapErrors) }
|
||
}} /></I18nProvider>)
|
||
fireEvent.click(screen.getByRole('button', { name: 'Haritayı içe / dışa aktar' }))
|
||
const dialog = await screen.findByRole('dialog')
|
||
const input = within(dialog).getByRole('textbox')
|
||
fireEvent.change(input, { target: { value: 'not a valid code !!!' } })
|
||
fireEvent.click(within(dialog).getByRole('button', { name: 'Yükle' }))
|
||
expect(within(dialog).getByText('Bu metin bir harita koduna benzemiyor.')).toBeTruthy()
|
||
expect((input as HTMLTextAreaElement).value).toBe('not a valid code !!!')
|
||
})
|
||
})
|