upleb.uk

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

summaryrefslogtreecommitdiff
path: root/tests/sync/catchup.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/catchup.rs
parenta958a55196537598492c3935ab46e3b6e23ee44b (diff)
refactor(tests): extract shared create_repo_announcement helper
Diffstat (limited to 'tests/sync/catchup.rs')
-rw-r--r--tests/sync/catchup.rs33
1 files changed, 0 insertions, 33 deletions
diff --git a/tests/sync/catchup.rs b/tests/sync/catchup.rs
index 2d0af16..1ddafd1 100644
--- a/tests/sync/catchup.rs
+++ b/tests/sync/catchup.rs
@@ -35,39 +35,6 @@ use nostr_sdk::prelude::*;
35 35
36use crate::common::{sync_helpers::*, TestRelay}; 36use crate::common::{sync_helpers::*, TestRelay};
37 37
38/// Create a valid repository announcement event for testing sync.
39///
40/// This creates a kind 30617 event with required clone and relays tags.
41/// The event lists all provided domains so it will be accepted by each
42/// relay's write policy.
43///
44/// # Arguments
45/// * `keys` - Keys for signing
46/// * `domains` - Slice of domain strings (e.g., "127.0.0.1:8080")
47/// * `identifier` - Repository identifier (d-tag)
48fn create_repo_announcement(keys: &Keys, domains: &[&str], identifier: &str) -> Event {
49 // Build clone URLs for all domains (with .git suffix)
50 let clone_urls: Vec<String> = domains
51 .iter()
52 .map(|d| format!("http://{}/{}.git", d, identifier))
53 .collect();
54
55 // Build relay URLs for all domains
56 let relay_urls: Vec<String> = domains.iter().map(|d| format!("ws://{}", d)).collect();
57
58 // Build tags for repository announcement
59 let tags = vec![
60 Tag::identifier(identifier),
61 Tag::custom(TagKind::custom("clone"), clone_urls),
62 Tag::custom(TagKind::custom("relays"), relay_urls),
63 ];
64
65 EventBuilder::new(Kind::Custom(KIND_REPOSITORY_STATE), "Repository state")
66 .tags(tags)
67 .sign_with_keys(keys)
68 .expect("Failed to sign repo announcement")
69}
70
71/// Test that relay performs catchup sync after being offline 38/// Test that relay performs catchup sync after being offline
72/// 39///
73/// # Scenario 40/// # Scenario