feat(domain): sheet.empty free op for a new sheet's document (V1-2.5 C)
Wraps create_empty_sheet_document; refusals invalid_shape / invalid_json; ts-rs SheetEmptyInput, core-wasm proof, app wrapper emptySheetDocument.
This commit is contained in:
1 parent
b0a4cbe588
commit
bbab0e61cb
8 files changed
+159
-4
No files matched your search
@@ -2,8 +2,8 @@
|
||||
* V1-2.2 on the shipped module (contract §8.1, §9.2, §10): the equine draft previews with the
|
||||
* index, the fingerprint and the canvases of the bundled sheet; hash and fingerprint
|
||||
* mismatches refuse the build with their closed kind; a draft's document is replaced and
|
||||
* redrawn; the edit commands run through `call`; every hostile SVG and flood gets a closed
|
||||
* cleaning answer with no trap. The owner's decisions of 2026-10-29 too: canvases scope their
|
||||
* redrawn; the edit commands and the empty document run through `call`; every hostile SVG
|
||||
* and flood gets a closed cleaning answer with no trap. The owner's decisions of 2026-10-29 too: canvases scope their
|
||||
* ids per view, dangling references and removals that leave a dependent are refused, the
|
||||
* stored form is what a file uploads, cairo's `rgb()` colours are kept. The Rust suites hold
|
||||
* the rules; this proves the facade.
|
||||
@@ -137,6 +137,21 @@ describe('PreviewSheet through the shipped module', () => {
|
||||
)
|
||||
expect(named.kind).toBe('has_dependents')
|
||||
})
|
||||
|
||||
it('answers the empty document of a new sheet, refusals closed', () => {
|
||||
const name = { fr: 'Nouvelle fiche', en: 'New sheet' }
|
||||
const document = value(glue.call('sheet.empty', JSON.stringify({ species_id: 'equine', name })))
|
||||
expect(document).toMatchObject({ species_id: 'equine', name, annotations: [] })
|
||||
const check = value(glue.call('sheet.check', JSON.stringify(document)))
|
||||
expect(check.issues.map((issue: { code: string }) => issue.code)).toEqual(['view.asset.missing'])
|
||||
for (const input of [
|
||||
{ species_id: 'Not An Id', name },
|
||||
{ species_id: 'equine', name: { fr: '', en: 'New sheet' } },
|
||||
{ species_id: 'equine', name, slug: 'equine' },
|
||||
]) {
|
||||
expect(JSON.parse(glue.call('sheet.empty', JSON.stringify(input))).kind).toBe('invalid_shape')
|
||||
}
|
||||
})
|
||||
})
|
||||
|
||||
describe('clean_svg through the shipped module', () => {
|
||||
|
||||
@@ -0,0 +1,7 @@
|
||||
// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually.
|
||||
import type { LocalizedText } from "./LocalizedText";
|
||||
|
||||
/**
|
||||
* A new sheet's starting point (V1-2 contract §7.4): the slug is not part of the document.
|
||||
*/
|
||||
export type SheetEmptyInput = { species_id: string, name: LocalizedText, };
|
||||
@@ -99,6 +99,7 @@ export type { SheetDependents } from './SheetDependents'
|
||||
export type { SheetDependentsInput } from './SheetDependentsInput'
|
||||
export type { SheetEditInput } from './SheetEditInput'
|
||||
export type { SheetEditOutput } from './SheetEditOutput'
|
||||
export type { SheetEmptyInput } from './SheetEmptyInput'
|
||||
export type { SheetIndexData } from './SheetIndexData'
|
||||
export type { SheetIssue } from './SheetIssue'
|
||||
export type { SheetIssueSeverity } from './SheetIssueSeverity'
|
||||
|
||||
Reference in new issue
Block a user