Files
smirk-backend-core/tests/capabilities.rs
T
jwinterm 1e2bdf3f16 feat: GET /api/v1/capabilities (client feature discovery)
Public, unauthenticated description of what this deployment offers, so the
wallet can adapt to the instance it's pointed at — grey out disabled chains and
features, and pick the right network. This is the client-facing half of the
open-core/feature-flag design: every capability is a config switch, surfaced
here. No secrets — only on/off flags and public network names.

Response: { version, chains: { btc/ltc/xmr/wow/grin: { enabled, network } },
features: { grin_relay, prices, nostr_identity, tips } }. UTXO chains carry
their configured network; CryptoNote/Grin report null. On the normal rate-limit
tier. Registered in openapi (system tag); 1 L1 test (public, well-shaped).
2026-06-25 16:27:13 -04:00

33 lines
1.1 KiB
Rust

//! L1 integration: the public capabilities endpoint.
mod common;
use axum::http::StatusCode;
#[tokio::test]
async fn capabilities_is_public_and_well_shaped() {
let app = require_app!();
// No token required — the wallet reads this before/without login.
let (status, body) = app.request("GET", "/api/v1/capabilities", None, None).await;
assert_eq!(status, StatusCode::OK);
assert!(body["version"].as_str().is_some(), "version present");
// Every chain reports an `enabled` boolean.
for chain in ["btc", "ltc", "xmr", "wow", "grin"] {
assert!(
body["chains"][chain]["enabled"].is_boolean(),
"chain {chain} reports enabled"
);
}
// UTXO chains carry a network; CryptoNote/Grin don't.
assert!(body["chains"]["btc"]["network"].as_str().is_some());
assert!(body["chains"]["xmr"]["network"].is_null());
// Feature flags are present.
for feat in ["grin_relay", "prices", "nostr_identity", "tips"] {
assert!(
body["features"][feat].is_boolean(),
"feature {feat} reports a boolean"
);
}
}