upleb.uk

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

summaryrefslogtreecommitdiff
path: root/tests/sync/discovery.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/discovery.rs
parenta958a55196537598492c3935ab46e3b6e23ee44b (diff)
refactor(tests): extract shared create_repo_announcement helper
Diffstat (limited to 'tests/sync/discovery.rs')
-rw-r--r--tests/sync/discovery.rs23
1 files changed, 0 insertions, 23 deletions
diff --git a/tests/sync/discovery.rs b/tests/sync/discovery.rs
index 5a39a8b..ec40802 100644
--- a/tests/sync/discovery.rs
+++ b/tests/sync/discovery.rs
@@ -17,29 +17,6 @@ use crate::common::{sync_helpers::*, TestRelay};
17/// Kind 1617 - Patch event (NIP-34) 17/// Kind 1617 - Patch event (NIP-34)
18const KIND_PATCH: u16 = 1617; 18const KIND_PATCH: u16 = 1617;
19 19
20/// Create a valid repository announcement event for testing sync.
21///
22/// This creates a kind 30617 event with required clone and relays tags.
23fn create_repo_announcement(keys: &Keys, domains: &[&str], identifier: &str) -> Event {
24 let clone_urls: Vec<String> = domains
25 .iter()
26 .map(|d| format!("http://{}/{}.git", d, identifier))
27 .collect();
28
29 let relay_urls: Vec<String> = domains.iter().map(|d| format!("ws://{}", d)).collect();
30
31 let tags = vec![
32 Tag::identifier(identifier),
33 Tag::custom(TagKind::custom("clone"), clone_urls),
34 Tag::custom(TagKind::custom("relays"), relay_urls),
35 ];
36
37 EventBuilder::new(Kind::Custom(KIND_REPOSITORY_STATE), "Repository state")
38 .tags(tags)
39 .sign_with_keys(keys)
40 .expect("Failed to sign repo announcement")
41}
42
43/// Create an event referencing a repository coordinate via 'a' tag. 20/// Create an event referencing a repository coordinate via 'a' tag.
44/// 21///
45/// Used to create Layer 2 events like patches that reference a repository. 22/// Used to create Layer 2 events like patches that reference a repository.