From cbed48d5a20b646a5bcc23e907d6163a3a8d36c5 Mon Sep 17 00:00:00 2001 From: DanConwayDev Date: Wed, 10 Dec 2025 16:59:09 +0000 Subject: refactor(tests): extract shared create_repo_announcement helper --- tests/sync/bootstrap.rs | 33 --------------------------------- 1 file changed, 33 deletions(-) (limited to 'tests/sync/bootstrap.rs') diff --git a/tests/sync/bootstrap.rs b/tests/sync/bootstrap.rs index 4428721..62a8fa5 100644 --- a/tests/sync/bootstrap.rs +++ b/tests/sync/bootstrap.rs @@ -14,39 +14,6 @@ use nostr_sdk::prelude::*; use crate::common::{sync_helpers::*, TestRelay}; -/// Create a valid repository announcement event for testing sync. -/// -/// This creates a kind 30617 event with required clone and relays tags. -/// The event lists all provided domains so it will be accepted by each -/// relay's write policy. -/// -/// # Arguments -/// * `keys` - Keys for signing -/// * `domains` - Slice of domain strings (e.g., "127.0.0.1:8080") -/// * `identifier` - Repository identifier (d-tag) -fn create_repo_announcement(keys: &Keys, domains: &[&str], identifier: &str) -> Event { - // Build clone URLs for all domains (with .git suffix) - let clone_urls: Vec = domains - .iter() - .map(|d| format!("http://{}/{}.git", d, identifier)) - .collect(); - - // Build relay URLs for all domains - let relay_urls: Vec = domains.iter().map(|d| format!("ws://{}", d)).collect(); - - // Build tags for repository announcement - let tags = vec![ - Tag::identifier(identifier), - Tag::custom(TagKind::custom("clone"), clone_urls), - Tag::custom(TagKind::custom("relays"), relay_urls), - ]; - - EventBuilder::new(Kind::Custom(KIND_REPOSITORY_STATE), "Repository state") - .tags(tags) - .sign_with_keys(keys) - .expect("Failed to sign repo announcement") -} - /// Test 1: Bootstrap sync - relay syncs existing events from bootstrap relay on startup /// /// Scenario: -- cgit v1.2.3