feat(anatomy): R5.4 review files in Rust (CHANGELOG, REVIEW-REPORT, review overlays, app drawings) and the whole-draft --check
This commit is contained in:
1 parent
43ce28a79b
commit
fef21d67ef
17 files changed
+2103
-52
No files matched your search
@@ -37,6 +37,23 @@ const CURATION: &str = "supabase/seed/anatomical-sheets/equine/curation";
|
||||
const DRAFT: &str = "supabase/seed/anatomical-sheets/equine/draft";
|
||||
|
||||
/// The files R5.3 produces; the review drawings and the Markdown reports are R5.4.
|
||||
/// The text files of the draft, in the TypeScript order; the review files (drawings, the two
|
||||
/// reports) are checked by `tests/curation_review.rs` (R5.4).
|
||||
const DRAFT_FILES: [&str; 11] = [
|
||||
"document.json",
|
||||
"assets.json",
|
||||
"sheet-ref.json",
|
||||
"report-migration-map.json",
|
||||
"review/annotations-main.svg",
|
||||
"review/annotations-head.svg",
|
||||
"review/app-main.svg",
|
||||
"review/app-head.svg",
|
||||
"CHANGELOG.md",
|
||||
"REVIEW-REPORT.md",
|
||||
"equine_draft.sql",
|
||||
];
|
||||
|
||||
/// The files R5.3 produced, compared byte for byte here.
|
||||
const R5_3_FILES: [&str; 5] = [
|
||||
"document.json",
|
||||
"assets.json",
|
||||
@@ -105,10 +122,13 @@ fn value<T: serde::Serialize + ?Sized>(value: &T) -> Value {
|
||||
#[test]
|
||||
fn the_r5_3_files_of_the_committed_draft_folder_are_reproduced_byte_for_byte() {
|
||||
let draft = equine_draft();
|
||||
let files = render_draft_artifacts(&draft).unwrap();
|
||||
let files = render_draft_artifacts(&draft, &[]).unwrap();
|
||||
let names: Vec<&str> = files.iter().map(|(name, _)| name.as_str()).collect();
|
||||
assert_eq!(names, R5_3_FILES);
|
||||
for (name, text) in &files {
|
||||
assert_eq!(names, DRAFT_FILES);
|
||||
for (name, text) in files
|
||||
.iter()
|
||||
.filter(|(name, _)| R5_3_FILES.contains(&name.as_str()))
|
||||
{
|
||||
assert!(
|
||||
*text == common::repo_file(&format!("{DRAFT}/{name}")),
|
||||
"{name} differs"
|
||||
@@ -122,7 +142,7 @@ fn the_r5_3_files_of_the_committed_draft_folder_are_reproduced_byte_for_byte() {
|
||||
|
||||
#[test]
|
||||
fn the_document_fingerprint_is_the_historical_value() {
|
||||
let files = render_draft_artifacts(&equine_draft()).unwrap();
|
||||
let files = render_draft_artifacts(&equine_draft(), &[]).unwrap();
|
||||
let document = &files[0].1;
|
||||
let reference: Value = serde_json::from_str(&files[2].1).unwrap();
|
||||
assert_eq!(
|
||||
@@ -177,8 +197,8 @@ fn the_draft_section_of_the_frozen_run_is_reproduced() {
|
||||
|
||||
#[test]
|
||||
fn two_runs_emit_the_same_bytes() {
|
||||
let first = render_draft_artifacts(&equine_draft()).unwrap();
|
||||
let second = render_draft_artifacts(&equine_draft()).unwrap();
|
||||
let first = render_draft_artifacts(&equine_draft(), &[]).unwrap();
|
||||
let second = render_draft_artifacts(&equine_draft(), &[]).unwrap();
|
||||
assert_eq!(first, second);
|
||||
}
|
||||
|
||||
@@ -202,7 +222,7 @@ fn node_is_leaf(
|
||||
#[test]
|
||||
fn the_612_legacy_leaves_migrate_through_the_produced_map_as_the_typescript_measured() {
|
||||
let draft = equine_draft();
|
||||
let files = render_draft_artifacts(&draft).unwrap();
|
||||
let files = render_draft_artifacts(&draft, &[]).unwrap();
|
||||
let map: ReportMigrationMap = serde_json::from_str(&files[3].1).unwrap();
|
||||
let document: AnatomicalSheetDocument = serde_json::from_value(draft.document.clone()).unwrap();
|
||||
let leaves = archive_support::legacy_leaves();
|
||||
@@ -517,13 +537,14 @@ fn mobility(document: &Value) -> &Value {
|
||||
&document["finding_zones"][0]["categories"][0]["children"][0]
|
||||
}
|
||||
|
||||
/// An inherited `Object.prototype` member name (`constructor`, `toString`, `__proto__`…) in a
|
||||
/// An inherited `Object.prototype` member name (`constructor`, `toString`, `valueOf`…) in a
|
||||
/// field path is an ordinary key in the port: it is never resolved through a prototype, the
|
||||
/// settable table still checks the first segment, and every object of the sheet contract is
|
||||
/// strict, so the key cannot reach the document. The only accepted form is a key a later op
|
||||
/// replaces: the document is then the one the later op alone gives; one record traces the
|
||||
/// overwritten write. The TypeScript refused that form (structuredClone of the function read).
|
||||
/// `__proto__` is refused at the op (`a_proto_segment_is_refused_at_the_op`).
|
||||
/// overwritten write (or removed with its item). The TypeScript refused that form
|
||||
/// (structuredClone of the function read). `__proto__` is not one of these names: it is
|
||||
/// refused at the op (`a_proto_segment_is_refused_at_the_op`).
|
||||
#[test]
|
||||
fn an_inherited_member_name_is_a_plain_key_and_bypasses_nothing() {
|
||||
let renamed = json!({ "fr": "Mobilité", "en": "Mobility" });
|
||||
|
||||
Reference in new issue
Block a user