upleb.uk

Public git repos — served from a NIP-34 GRASP relay at git.upleb.uk

summaryrefslogtreecommitdiff
path: root/tests/sync/live_sync.rs
diff options
context:
space:
mode:
authorDanConwayDev <DanConwayDev@protonmail.com>2025-12-10 16:59:09 +0000
committerDanConwayDev <DanConwayDev@protonmail.com>2025-12-10 16:59:09 +0000
commitcbed48d5a20b646a5bcc23e907d6163a3a8d36c5 (patch)
treed01b4e49e5ffadc8f12f00f44e015531fa2deadb /tests/sync/live_sync.rs
parenta958a55196537598492c3935ab46e3b6e23ee44b (diff)
refactor(tests): extract shared create_repo_announcement helper
Diffstat (limited to 'tests/sync/live_sync.rs')
-rw-r--r--tests/sync/live_sync.rs33
1 files changed, 0 insertions, 33 deletions
diff --git a/tests/sync/live_sync.rs b/tests/sync/live_sync.rs
index 3432687..9342cde 100644
--- a/tests/sync/live_sync.rs
+++ b/tests/sync/live_sync.rs
@@ -24,39 +24,6 @@ use nostr_sdk::prelude::*;
24 24
25use crate::common::{sync_helpers::*, TestRelay}; 25use crate::common::{sync_helpers::*, TestRelay};
26 26
27/// Create a valid repository announcement event for testing sync.
28///
29/// This creates a kind 30617 event with required clone and relays tags.
30/// The event lists all provided domains so it will be accepted by each
31/// relay's write policy.
32///
33/// # Arguments
34/// * `keys` - Keys for signing
35/// * `domains` - Slice of domain strings (e.g., "127.0.0.1:8080")
36/// * `identifier` - Repository identifier (d-tag)
37fn create_repo_announcement(keys: &Keys, domains: &[&str], identifier: &str) -> Event {
38 // Build clone URLs for all domains (with .git suffix)
39 let clone_urls: Vec<String> = domains
40 .iter()
41 .map(|d| format!("http://{}/{}.git", d, identifier))
42 .collect();
43
44 // Build relay URLs for all domains
45 let relay_urls: Vec<String> = domains.iter().map(|d| format!("ws://{}", d)).collect();
46
47 // Build tags for repository announcement
48 let tags = vec![
49 Tag::identifier(identifier),
50 Tag::custom(TagKind::custom("clone"), clone_urls),
51 Tag::custom(TagKind::custom("relays"), relay_urls),
52 ];
53
54 EventBuilder::new(Kind::Custom(KIND_REPOSITORY_STATE), "Repository state")
55 .tags(tags)
56 .sign_with_keys(keys)
57 .expect("Failed to sign repo announcement")
58}
59
60/// Test 5: Live sync Layer 2 events 27/// Test 5: Live sync Layer 2 events
61/// 28///
62/// Verifies that Layer 2 events (kind 1618 issues) published to one relay 29/// Verifies that Layer 2 events (kind 1618 issues) published to one relay