lib

Core libraries for Radroots
git clone https://radroots.dev/git/lib.git
Log | Files | Refs | README | LICENSE

commit 789cda9eb3f77d98830b6844e3520ac883d293b7
parent 7966cb007b2f29dd7c447fccab93eba1ca79159e
Author: triesap <tyson@radroots.org>
Date:   Sun, 22 Mar 2026 18:16:32 +0000

nostr-ndb: use approved metadata fixtures in tests

Diffstat:
MCargo.lock | 1+
Mcrates/nostr-ndb/Cargo.toml | 1+
Mcrates/nostr-ndb/src/ndb.rs | 16++++++++++------
3 files changed, 12 insertions(+), 6 deletions(-)

diff --git a/Cargo.lock b/Cargo.lock @@ -2286,6 +2286,7 @@ dependencies = [ "nostrdb", "radroots-nostr", "radroots-nostr-runtime", + "radroots-test-fixtures", "serde_json", "tempfile", "thiserror 1.0.69", diff --git a/crates/nostr-ndb/Cargo.toml b/crates/nostr-ndb/Cargo.toml @@ -38,5 +38,6 @@ thiserror = { workspace = true } tokio = { workspace = true, optional = true, features = ["rt", "sync", "time"] } [dev-dependencies] +radroots-test-fixtures = { workspace = true } tokio = { workspace = true, features = ["macros", "rt", "sync", "time"] } tempfile = { workspace = true } diff --git a/crates/nostr-ndb/src/ndb.rs b/crates/nostr-ndb/src/ndb.rs @@ -354,6 +354,7 @@ mod tests { use futures::StreamExt; use radroots_nostr::prelude::{RadrootsNostrEventBuilder, RadrootsNostrKeys}; use radroots_nostr::prelude::{RadrootsNostrMetadata, radroots_nostr_build_metadata_event}; + use radroots_test_fixtures::{FIXTURE_ALICE_EMAIL, FIXTURE_ALICE_USERNAME}; use std::sync::atomic::Ordering; use std::sync::{Mutex, OnceLock}; use std::time::Duration; @@ -780,10 +781,10 @@ mod tests { let keys = RadrootsNostrKeys::generate(); let pubkey_hex = keys.public_key().to_hex(); let metadata = RadrootsNostrMetadata::new() - .name("alice") - .display_name("Alice") + .name(FIXTURE_ALICE_USERNAME) + .display_name(FIXTURE_ALICE_USERNAME) .about("coffee operator") - .lud16("alice@example.com"); + .lud16(FIXTURE_ALICE_EMAIL); let metadata_event = radroots_nostr_build_metadata_event(&metadata) .sign_with_keys(&keys) .expect("metadata event should sign"); @@ -802,9 +803,12 @@ mod tests { } let profile = profile.expect("profile should exist"); assert_eq!(profile.pubkey_hex, pubkey_hex); - assert_eq!(profile.name.as_deref(), Some("alice")); - assert_eq!(profile.display_name.as_deref(), Some("Alice")); - assert_eq!(profile.lud16.as_deref(), Some("alice@example.com")); + assert_eq!(profile.name.as_deref(), Some(FIXTURE_ALICE_USERNAME)); + assert_eq!( + profile.display_name.as_deref(), + Some(FIXTURE_ALICE_USERNAME) + ); + assert_eq!(profile.lud16.as_deref(), Some(FIXTURE_ALICE_EMAIL)); } #[test]