diff options
Diffstat (limited to 'tests/production_surface.rs')
| -rw-r--r-- | tests/production_surface.rs | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/tests/production_surface.rs b/tests/production_surface.rs index 26f50ea..e978a2c 100644 --- a/tests/production_surface.rs +++ b/tests/production_surface.rs @@ -159,3 +159,33 @@ fn a_default_config_has_no_hooks_attached() { let json = serde_json::to_string(&cfg).unwrap(); assert!(!json.contains("publish_fault"), "hooks leaked into the serialized config: {json}"); } + +#[test] +fn the_review_modules_do_not_keep_private_copies_of_the_rules() { + // §6 m-2: `hosts` existed twice, verbatim, and the "did the executable part + // of the recipe change" rule existed twice with *different* semantics — the + // diff panel compared function header lines, the risk scorer compared the + // bodies. One question, one answer, in the module that owns the subject. + for (file, forbidden) in [ + ("src/review/diff.rs", ["fn hosts(", "fn body_changed("]), + ("src/review/risk.rs", ["fn hosts(", "fn body_changed("]), + ] { + let src = read(file); + for f in forbidden { + assert!(!src.contains(f), "{file} still defines {f} — use recipe::bodies_changed / urlutil::hosts"); + } + } + assert!(read("src/review/diff.rs").contains("urlutil::hosts")); + assert!(read("src/review/risk.rs").contains("urlutil::hosts")); + assert!(read("src/review/diff.rs").contains("recipe::bodies_changed")); + assert!(read("src/review/risk.rs").contains("recipe::bodies_changed")); +} + +#[test] +fn audit_rows_are_built_by_the_constructors_not_by_hand() { + // §6 m-4: three review sites hand-built `AuditEntry` literals, each with its + // own `detail` shape and its own spelling of `actor_kind`. + let src = read("src/review/approve.rs"); + assert!(!src.contains("db::AuditEntry {"), "audit rows must be built by AuditEntry::human/system"); + assert_eq!(src.matches("AuditEntry::human(").count(), 3, "approve, reject and withdraw"); +} |
