71 lines
2.2 KiB
Rust
71 lines
2.2 KiB
Rust
// file: crates/ksp-app-raw-transaction-ingest-desk/tests/release_completeness.rs
|
|
// version: 2
|
|
|
|
//! Release-completeness canaries for the Raw Transaction Ingest Desk scaffold tranche.
|
|
|
|
#![forbid(unsafe_code)]
|
|
#![deny(unreachable_pub)]
|
|
#![warn(missing_docs)]
|
|
|
|
fn app_root() -> std::path::PathBuf {
|
|
return std::path::PathBuf::from(env!("CARGO_MANIFEST_DIR"));
|
|
}
|
|
|
|
fn read_text(path: &std::path::Path) -> String {
|
|
let source = std::fs::read_to_string(path);
|
|
assert!(source.is_ok(), "unable to read {}", path.display());
|
|
return match source {
|
|
std::result::Result::Ok(value) => value,
|
|
std::result::Result::Err(_) => String::new(),
|
|
};
|
|
}
|
|
|
|
#[test]
|
|
fn pre_005_production_module_inventory_is_exact_and_scaffold_only() {
|
|
let lib = read_text(app_root().join("src/lib.rs").as_path());
|
|
let expected = [
|
|
"mod app_state;",
|
|
"mod bootstrap;",
|
|
"mod constants;",
|
|
"mod dto_common;",
|
|
"mod dto_route;",
|
|
"mod errors;",
|
|
"mod frontend_logging;",
|
|
"mod logging_runtime;",
|
|
"mod splash;",
|
|
"mod tauri;",
|
|
"mod tw_main;",
|
|
"mod tw_splash;",
|
|
];
|
|
assert_eq!(lib.matches("mod ").count(), expected.len());
|
|
for module in expected {
|
|
assert!(lib.contains(module));
|
|
}
|
|
}
|
|
|
|
#[test]
|
|
fn pre_005_public_surface_exposes_only_application_run_entry_point() {
|
|
let lib = read_text(app_root().join("src/lib.rs").as_path());
|
|
let public_reexports = lib.lines().filter(|line| return line.starts_with("pub use ")).collect::<std::vec::Vec<_>>();
|
|
assert_eq!(public_reexports, vec!["pub use self::tauri::run;"]);
|
|
}
|
|
|
|
#[test]
|
|
fn pre_005_scaffold_keeps_start_stop_inventory_and_runtime_for_later_tranches() {
|
|
let app = read_text(app_root().join("src/app_state.rs").as_path());
|
|
let tauri = read_text(app_root().join("src/tauri.rs").as_path());
|
|
for forbidden in [
|
|
"RawTransactionIngestWorker",
|
|
"RawTransactionIngestRuntimeResources",
|
|
"request_stop",
|
|
"start_with_runtime_resources",
|
|
"Store::open",
|
|
"HttpTransportPool",
|
|
"WsProtocolSession",
|
|
"YellowstoneGrpcChannel",
|
|
] {
|
|
assert!(!app.contains(forbidden));
|
|
assert!(!tauri.contains(forbidden));
|
|
}
|
|
}
|