commit 1c16fd4022875fa757f47ffad5c80a25b6047f55
parent 0cdf5e7c21bf41e5659537377682aab306193df6
Author: triesap <tyson@radroots.org>
Date: Sun, 19 Jul 2026 20:45:01 +0000
tests: use explicit wire-event fixtures
Construct signed relay fixtures through a test-only upstream Nostr builder while preserving tag parsing and self-tag behavior.
Remove the CLI test suite from the retired generic radroots_nostr authoring helper and refresh its standalone lockfile.
Diffstat:
2 files changed, 29 insertions(+), 9 deletions(-)
diff --git a/Cargo.lock b/Cargo.lock
@@ -2017,6 +2017,7 @@ dependencies = [
"mediatype",
"serde",
"sha2",
+ "unicode-general-category",
"url",
]
@@ -2090,6 +2091,7 @@ dependencies = [
"serde",
"serde_json",
"sha2",
+ "unicode-general-category",
"url",
]
@@ -2098,6 +2100,7 @@ name = "radroots_event_codec"
version = "1.0.0-alpha.1"
dependencies = [
"nostr",
+ "radroots_blossom",
"radroots_core",
"radroots_event",
"serde",
@@ -3527,6 +3530,12 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "2896d95c02a80c6d6a5d6e953d479f5ddf2dfdb6a244441010e373ac0fb88971"
[[package]]
+name = "unicode-general-category"
+version = "1.1.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "0b993bddc193ae5bd0d623b49ec06ac3e9312875fdae725a975c51db1cc1677f"
+
+[[package]]
name = "unicode-ident"
version = "1.0.24"
source = "registry+https://github.com/rust-lang/crates.io-index"
diff --git a/src/runtime/sync.rs b/src/runtime/sync.rs
@@ -1776,7 +1776,7 @@ mod tests {
use radroots_event_codec::profile::authored::authored_profile_to_wire_parts;
use radroots_identity::RadrootsIdentity;
use radroots_nostr::prelude::{
- RadrootsNostrEvent, RadrootsNostrFilter, RadrootsNostrTimestamp, radroots_nostr_build_event,
+ RadrootsNostrEvent, RadrootsNostrFilter, RadrootsNostrTimestamp,
};
use radroots_sdk::{
PushOutboxEventReceipt, PushOutboxEventState, PushOutboxReceipt,
@@ -3086,10 +3086,10 @@ mod tests {
title: &str,
created_at: u64,
) -> RadrootsNostrEvent {
- let mut builder = radroots_nostr_build_event(
- KIND_LISTING,
- "# Pasture Eggs",
- vec![
+ let mut builder = wire_fixture_builder(RadrootsNip01EventWireParts {
+ kind: KIND_LISTING,
+ content: "# Pasture Eggs".to_owned(),
+ tags: vec![
vec!["d".to_owned(), LISTING_D_TAG.to_owned()],
vec![
"a".to_owned(),
@@ -3127,8 +3127,7 @@ mod tests {
vec!["inventory".to_owned(), "5".to_owned()],
vec!["status".to_owned(), "active".to_owned()],
],
- )
- .expect("listing parts");
+ });
if created_at > 0 {
builder = builder.custom_created_at(RadrootsNostrTimestamp::from(created_at));
}
@@ -3141,12 +3140,24 @@ mod tests {
identity: &RadrootsIdentity,
parts: RadrootsNip01EventWireParts,
) -> RadrootsNostrEvent {
- radroots_nostr_build_event(parts.kind, parts.content, parts.tags)
- .expect("event builder")
+ wire_fixture_builder(parts)
.sign_with_keys(identity.keys())
.expect("signed event")
}
+ fn wire_fixture_builder(parts: RadrootsNip01EventWireParts) -> nostr::EventBuilder {
+ let kind = u16::try_from(parts.kind).expect("fixture kind must fit NIP-01");
+ let tags = parts
+ .tags
+ .into_iter()
+ .filter(|tag| !tag.is_empty())
+ .map(|tag| nostr::Tag::parse(tag).expect("fixture tag must parse"))
+ .collect::<Vec<_>>();
+ nostr::EventBuilder::new(nostr::Kind::Custom(kind), parts.content)
+ .tags(tags)
+ .allow_self_tagging()
+ }
+
fn identity(seed: u8) -> RadrootsIdentity {
RadrootsIdentity::from_secret_key_bytes(&[seed; 32]).expect("identity")
}