v0.2.12-pre.006
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
// file: crates/ksp-app-solprices-desk/tests/desktop_contract.rs
|
||||
// version: 5
|
||||
// version: 6
|
||||
|
||||
//! Desktop scaffold, shared-template and Config packaging contract audits for SOL Prices Desk `0.2.12`.
|
||||
|
||||
@@ -192,29 +192,21 @@ fn pre_002_fix_001_reuses_the_common_ksp_desktop_template() {
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn pre_005_market_price_runtime_adds_single_refresh_without_many_or_all_controls() {
|
||||
fn pre_005_market_price_runtime_preserves_single_refresh_contract() {
|
||||
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" }"#));
|
||||
assert!(!manifest.contains("reqwest"));
|
||||
let lib_rs = read_text(root.join("src/lib.rs").as_path());
|
||||
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("self.begin_refresh(provider_ids.as_slice())"));
|
||||
assert!(runtime_rs.contains("apply_outcome_to_state"));
|
||||
let tauri_rs = read_text(root.join("src/tauri.rs").as_path());
|
||||
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="marketPriceTable""#));
|
||||
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#""refresh_market_price""#));
|
||||
assert!(main_typescript.contains("SOL Prices Desk market-price refresh control clicked"));
|
||||
@@ -224,3 +216,33 @@ fn pre_005_market_price_runtime_adds_single_refresh_without_many_or_all_controls
|
||||
assert!(!main_typescript.contains("parseFloat("));
|
||||
assert!(!main_typescript.contains("Number(provider.price"));
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn pre_006_market_price_runtime_adds_selected_and_global_refresh_without_polling() {
|
||||
let root = app_root();
|
||||
let lib_rs = read_text(root.join("src/lib.rs").as_path());
|
||||
assert!(lib_rs.contains("MarketPriceRefreshManyRequestDto"));
|
||||
assert!(lib_rs.contains("MarketPriceRefreshResultDto"));
|
||||
let runtime_rs = read_text(root.join("src/market_price_runtime.rs").as_path());
|
||||
assert!(runtime_rs.contains("pub(crate) async fn refresh_many"));
|
||||
assert!(runtime_rs.contains("service().refresh_many(provider_ids.as_slice()).await"));
|
||||
assert!(runtime_rs.contains("pub(crate) async fn refresh_all"));
|
||||
assert!(runtime_rs.contains("service().refresh_all().await"));
|
||||
assert!(runtime_rs.contains("begin_refresh_in_state"));
|
||||
let tauri_rs = read_text(root.join("src/tauri.rs").as_path());
|
||||
assert!(tauri_rs.contains("refresh_market_prices"));
|
||||
assert!(tauri_rs.contains("refresh_all_market_prices"));
|
||||
let main_html = read_text(root.join("frontend/main.html").as_path());
|
||||
assert!(main_html.contains(r#"id="refreshSelectedButton""#));
|
||||
assert!(main_html.contains(r#"id="refreshAllButton""#));
|
||||
assert!(main_html.contains(r#"id="selectedProviderCount""#));
|
||||
let main_typescript = read_text(root.join("frontend/ts/main.ts").as_path());
|
||||
assert!(main_typescript.contains(r#""refresh_market_prices""#));
|
||||
assert!(main_typescript.contains(r#""refresh_all_market_prices""#));
|
||||
assert!(main_typescript.contains("selectedProviderIdsInRowOrder"));
|
||||
assert!(main_typescript.contains("SOL Prices Desk selected market-price refresh control clicked"));
|
||||
assert!(main_typescript.contains("SOL Prices Desk global market-price refresh control clicked"));
|
||||
for forbidden in ["setInterval(", "setTimeout(", "requestAnimationFrame("] {
|
||||
assert!(!main_typescript.contains(forbidden), "pre.006 must not add consumer scheduling: {forbidden}");
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user