fix(editor): verifier gaps: ratified wordings, copy messages, real SVG journeys

This commit is contained in:
bchanot committed 2026-11-04 17:27:45 +01:00
1 parent 9ba6d2b66c
commit d10ba5d5dd
18 files changed
+227 -97

No files matched your search

+18
View File
@@ -0,0 +1,18 @@
import { describe, expect, it } from 'vitest'
import { failureMessage } from '@/admin/labels'
import { en } from '@/i18n/en'
import { fr } from '@/i18n/fr'
describe('failure messages of the submission', () => {
it.each(['round.open', 'view.asset.unknown'] as const)(
'%s has its own wording, never the generic unavailable one',
(kind) => {
for (const dict of [fr, en]) {
const t = (key: string) => dict[key]
const message = failureMessage(t, kind)
expect(message).toBe(dict[`admin.failure.${kind}`])
expect(message).not.toBe(dict['admin.failure.unavailable'])
}
},
)
})
@@ -241,9 +241,7 @@ describe('drawing upload flow', () => {
new SheetFailure('size_mismatch'),
)
await pick(svg('0 0 200 100'))
expect(
await screen.findByText(/ne correspond pas à celle annoncée/),
).toBeTruthy()
expect(await screen.findByText(/diffère de celle enregistrée/)).toBeTruthy()
expect(mainAsset()).toBe(ASSET)
})
@@ -252,7 +250,9 @@ describe('drawing upload flow', () => {
sb.downloadSheetDrawing.mockResolvedValue(new TextEncoder().encode('autre'))
await pick(svg('0 0 200 100'))
expect(
await screen.findByText(/Un fichier différent existe déjà/),
await screen.findByText(
/ne correspond pas à son empreinte SHA-256 enregistrée/,
),
).toBeTruthy()
expect(mainAsset()).toBe(ASSET)
})
@@ -139,7 +139,7 @@ describe('the blocking offer', () => {
const dialog = within(await screen.findByRole('dialog'))
expect(
dialog.getByText(
/Abandonner la copie locale non enregistrée \(révision 3, \d\d:\d\d\) \? Elle sera supprimée de cet onglet\./,
/Abandonner la copie locale temporaire de cet onglet, non enregistrée sur le serveur \(révision 3, \d\d:\d\d\) \? Elle sera supprimée de cet onglet\./,
),
).toBeInTheDocument()
await user.click(dialog.getByRole('button', { name: 'Annuler' }))
@@ -190,7 +190,7 @@ describe('the blocking offer', () => {
await user.click(screen.getByRole('button', { name: 'Restaurer la copie' }))
expect(
await screen.findByText(
/La copie locale ne passe pas le contrôle du document : .+\. Elle est conservée\./,
/Le contrôle du document refuse cette copie : .+\. Elle reste dans cet onglet\./,
),
).toBeInTheDocument()
expect(
@@ -268,7 +268,7 @@ describe('cap and quota', () => {
await ready()
act(() => void commitMove(40))
expect(
await screen.findByText('Copie locale impossible (stockage plein)'),
await screen.findByText(fr['editor.draft.status.copy_quota']),
).toBeInTheDocument()
expect(
screen.getByText(fr['editor.draft.copy_issue.quota']),
+2 -2
View File
@@ -368,7 +368,7 @@ describe('permission lost during the session', () => {
await refusedSave('draft.frozen')
expect(
await screen.findByText(/Une revue est en cours sur ce brouillon/),
).toHaveTextContent('Une copie locale temporaire existe dans cet onglet.')
).toHaveTextContent(fr['editor.draft.copy_kept'])
expect(screen.getByText('Lecture seule')).toBeInTheDocument()
expect(screen.queryByRole('button', { name: 'Enregistrer' })).toBeNull()
expect(sb.saveSheetDraft).toHaveBeenCalledTimes(1)
@@ -385,7 +385,7 @@ describe('permission lost during the session', () => {
await ready()
act(() => void commitMove(40))
expect(
await screen.findByText('Copie locale impossible (stockage plein)'),
await screen.findByText(fr['editor.draft.status.copy_quota']),
).toBeInTheDocument()
await user.click(screen.getByRole('button', { name: 'Enregistrer' }))
const notice = await screen.findByText(/Votre session a expiré/)
@@ -145,7 +145,7 @@ describe('Vues et illustrations: drawing states', () => {
await vi.waitFor(() => expect(store.getState().status).toBe('ready'))
render(<ViewsTab {...props} />)
expect(
screen.getByText(/ne correspond pas à son empreinte enregistrée/),
screen.getByText(/ne correspond pas à son empreinte SHA-256 enregistrée/),
).toBeTruthy()
expect(screen.queryByText(/introuvable/)).toBeNull()
})