v0.2.12-pre.005
This commit is contained in:
@@ -192,7 +192,7 @@ fn pre_002_fix_001_reuses_the_common_ksp_desktop_template() {
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn pre_004_market_price_runtime_projects_registry_rows_without_refresh_controls() {
|
||||
fn pre_005_market_price_runtime_adds_single_refresh_without_many_or_all_controls() {
|
||||
let root = app_root();
|
||||
let manifest = read_text(root.join("Cargo.toml").as_path());
|
||||
assert!(manifest.contains(r#"ksp-offchain-transport-lib = { path = "../ksp-offchain-transport-lib" }"#));
|
||||
@@ -201,21 +201,26 @@ fn pre_004_market_price_runtime_projects_registry_rows_without_refresh_controls(
|
||||
assert!(lib_rs.contains("mod market_price_runtime;"));
|
||||
assert!(lib_rs.contains("MarketPriceProviderRowDto"));
|
||||
assert!(lib_rs.contains("MarketPriceRuntime"));
|
||||
let runtime_rs = read_text(root.join("src/market_price_runtime.rs").as_path());
|
||||
assert!(runtime_rs.contains("pub(crate) async fn refresh_one"));
|
||||
assert!(runtime_rs.contains("service().refresh(&provider_id).await"));
|
||||
assert!(runtime_rs.contains("self.set_loading(&provider_id, true)"));
|
||||
assert!(runtime_rs.contains("apply_outcome_to_state"));
|
||||
let tauri_rs = read_text(root.join("src/tauri.rs").as_path());
|
||||
assert!(tauri_rs.contains("list_market_prices"));
|
||||
for forbidden in ["refresh_market_price", "refresh_market_prices", "refresh_all_market_prices"] {
|
||||
assert!(tauri_rs.contains("refresh_market_price"));
|
||||
for forbidden in ["refresh_market_prices", "refresh_all_market_prices"] {
|
||||
assert!(!tauri_rs.contains(forbidden));
|
||||
}
|
||||
let main_html = read_text(root.join("frontend/main.html").as_path());
|
||||
assert!(main_html.contains(r#"id="pricesLoading""#));
|
||||
assert!(main_html.contains(r#"id="pricesEmpty""#));
|
||||
assert!(main_html.contains(r#"id="marketPriceTable""#));
|
||||
assert!(main_html.contains(r#"id="marketPriceRows""#));
|
||||
assert!(!main_html.contains("Refresh"));
|
||||
assert!(main_html.contains(">Action</th>"));
|
||||
assert!(main_html.contains("rafraîchie explicitement"));
|
||||
let main_typescript = read_text(root.join("frontend/ts/main.ts").as_path());
|
||||
assert!(main_typescript.contains(r#""list_market_prices""#));
|
||||
assert!(main_typescript.contains("MarketPriceProviderRowDto"));
|
||||
assert!(main_typescript.contains(r#"provider.price ?? "—""#));
|
||||
assert!(main_typescript.contains(r#""refresh_market_price""#));
|
||||
assert!(main_typescript.contains("SOL Prices Desk market-price refresh control clicked"));
|
||||
assert!(main_typescript.contains("provider.providerId"));
|
||||
assert!(main_typescript.contains("provider.loading"));
|
||||
assert!(main_typescript.contains("Refreshing…"));
|
||||
assert!(!main_typescript.contains("parseFloat("));
|
||||
assert!(!main_typescript.contains("Number(provider.price"));
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
// file: crates/ksp-app-solprices-desk/tests/desktop_security.rs
|
||||
// version: 3
|
||||
// version: 4
|
||||
|
||||
//! Security, ownership and frontend instrumentation canaries for SOL Prices Desk.
|
||||
|
||||
@@ -69,7 +69,7 @@ fn pre_002_frontend_has_no_network_persistence_or_native_dialog_surface() {
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn pre_004_tauri_commands_remain_centralized_and_refresh_is_absent() {
|
||||
fn pre_005_tauri_commands_remain_centralized_and_only_single_refresh_is_present() {
|
||||
let root = app_root();
|
||||
let mut rust_files = std::vec::Vec::new();
|
||||
collect_files(root.join("src").as_path(), "rs", &mut rust_files);
|
||||
@@ -82,13 +82,19 @@ fn pre_004_tauri_commands_remain_centralized_and_refresh_is_absent() {
|
||||
} else {
|
||||
assert_eq!(count, 0, "{} declares a Tauri command outside tauri.rs", path.display());
|
||||
}
|
||||
assert!(!source.contains("refresh_market_price"), "{} advances refresh commands before their planned tranche", path.display());
|
||||
if path.file_name().and_then(std::ffi::OsStr::to_str) != std::option::Option::Some("tauri.rs") {
|
||||
assert!(!source.contains("refresh_market_price"), "{} declares refresh command plumbing outside tauri.rs", path.display());
|
||||
}
|
||||
assert!(!source.contains("refresh_market_prices"), "{} advances multi-refresh before pre.006", path.display());
|
||||
assert!(!source.contains("refresh_all_market_prices"), "{} advances global refresh before pre.006", path.display());
|
||||
}
|
||||
assert_eq!(command_count, 4);
|
||||
assert_eq!(command_count, 5);
|
||||
let tauri = read_text(root.join("src/tauri.rs").as_path());
|
||||
assert!(tauri.contains("refresh_market_price"));
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn pre_004_frontend_registry_loading_is_logged_without_business_values() {
|
||||
fn pre_005_frontend_refresh_interactions_are_logged_without_business_values() {
|
||||
let root = app_root();
|
||||
let main = read_text(root.join("frontend/ts/main.ts").as_path());
|
||||
let invoke = read_text(root.join("frontend/ts/invoke.ts").as_path());
|
||||
@@ -101,6 +107,9 @@ fn pre_004_frontend_registry_loading_is_logged_without_business_values() {
|
||||
assert!(invoke.contains("frontendTrace"));
|
||||
assert!(main.contains("SOL Prices Desk provider registry load started"));
|
||||
assert!(main.contains("SOL Prices Desk market-price registry rows rendered"));
|
||||
assert!(main.contains("SOL Prices Desk market-price refresh control clicked"));
|
||||
assert!(main.contains("SOL Prices Desk market-price refresh row applied"));
|
||||
assert!(main.contains("SOL Prices Desk market-price refresh failed"));
|
||||
for forbidden in ["JSON.stringify(status)", "JSON.stringify(payload)", "apiKey", "authorization"] {
|
||||
assert!(!main.contains(forbidden), "main frontend logging must not serialize business/secret values: {forbidden}");
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user