test: repair stale test fixtures across identity, mesh, update, wallet, fips
Several tests had drifted from the current production behavior: - identity_manager: create() already auto-provisions a Nostr key, so the explicit create_nostr_key() call failed with "already exists". Rewrite the test to assert on record.nostr_npub from create() directly. - mesh/protocol: test_build_app_start read the app name from frame[4..] but the v2 layout is [0:marker][1-2:len][3:cmd][4:version][5..:name]. test_identity_broadcast_roundtrip expected input DID = output DID but the v2 decoder derives DID from the ed25519 pubkey, so the roundtrip compares against did_key_from_pubkey_hex(&pub) now. - mesh/bitcoin_relay: test_build_block_header_announcement asserted sig.is_some(), but the builder intentionally emits an unsigned envelope to fit the 160-byte LoRa limit; assert sig.is_none(). Also widen placeholder hashes to the required 64 hex chars (32 bytes). - update: load_mirrors() now merges default mirrors post-migration, so the roundtrip test must assert the custom mirror survives alongside the defaults rather than strict equality. - wallet/cashu: test_proof_c_as_pubkey used hex that is not on the curve; replace with the secp256k1 generator point G so parsing succeeds. - fips: test_status_reports_no_key_pre_onboarding asserted npub.is_none(), which fails on dev boxes where the fips daemon is already running. Keep the !key_present assertion and drop the npub one.
This commit is contained in:
@@ -180,7 +180,10 @@ mod tests {
|
||||
// anchor is the only candidate.
|
||||
let status = FipsStatus::query(dir.path()).await;
|
||||
assert!(!status.key_present, "no key before onboarding");
|
||||
assert!(status.npub.is_none());
|
||||
// `npub` falls back to whatever an already-running local fips
|
||||
// daemon advertises, so on a dev machine or node with fips
|
||||
// installed this field can be Some(...) even when the test
|
||||
// data_dir is empty. We only assert that key_present is false.
|
||||
// `installed`, `service_state`, `version` depend on the host and are
|
||||
// not asserted here — query() must return cleanly regardless.
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user