refactor(app): split the crop group hook, closed reason in drawing refusals

This commit is contained in:
bchanot committed 2026-11-04 13:36:09 +01:00
1 parent 1bbf97e65b
commit 7ea9619aa0
3 files changed
+82 -25

No files matched your search

@@ -14,6 +14,7 @@ import ViewsTab from '@/components/editor/tabs/ViewsTab'
import { cleanSvg } from '@/editor/core/cleaning'
import { createHash } from 'node:crypto'
import { getDict } from '@/i18n'
import { frameRefusalMessage } from '@/editor/frameRefusal'
import { uploadErrorMessage } from '@/editor/uploadMessages'
import { MAX_DRAWING_BYTES, attachToView } from '@/editor/drawingUpload'
import { useLocaleStore } from '@/state/localeStore'
@@ -296,3 +297,22 @@ describe('drawing upload flow', () => {
)
})
})
describe('frame refusal for a rejected drawing', () => {
it('phrases not_canonical and a reader reason as closed messages', () => {
const t = (key: string) => getDict('fr')[key as never] as string
const refusal = (drawingDetail: string) => ({
reason: 'drawing_rejected' as const,
annotationIds: [],
issues: [],
viewIds: [],
drawingDetail,
})
expect(
frameRefusalMessage(t, refusal('not_canonical'), null, 'fr'),
).toMatch(/pas sous la forme enregistrée/)
expect(frameRefusalMessage(t, refusal('doctype'), null, 'fr')).toMatch(
/DOCTYPE/,
)
})
})