test(editor): lot K review fixes, filled-document save proof

This commit is contained in:
bchanot committed 2026-11-04 15:52:15 +01:00
1 parent bb99edd2dd
commit 4cc27a8231
10 files changed
+132 -32

No files matched your search

+21 -3
View File
@@ -227,9 +227,8 @@ export async function seedDraft(
}
/**
* The categories, zone and detail view most editor specs start from. Every defaulted
* field is written out, as the core writes a document: the page reads the stored text
* as it is (an omitted `reference_ids` breaks the findings tree, see the report).
* The categories, zone and detail view most editor specs start from, written in full.
* `bareShape` below omits the defaulted fields (the loader fills them from the core).
*/
export function standardShape(document: Record<string, unknown>) {
document.categories = [
@@ -272,6 +271,25 @@ export function standardShape(document: Record<string, unknown>) {
})
}
/** Like `standardShape`, but nodes and categories omit what the core defaults. */
export function bareShape(document: Record<string, unknown>) {
standardShape(document)
document.finding_zones = [
{
id: 'zone-bare',
name: text('Zone nue'),
categories: [
{
id: 'fcat-bare',
kind: 'dysfunction',
name: text('Catégorie nue'),
children: [{ id: 'node-bare', name: text('Constat nu') }],
},
],
},
]
}
export const draftPath = (sheetId: string) =>
`/app/admin/sheets/${sheetId}/draft`