diff options
Diffstat (limited to 'tests/nip77_negentropy.rs')
| -rw-r--r-- | tests/nip77_negentropy.rs | 27 |
1 files changed, 16 insertions, 11 deletions
diff --git a/tests/nip77_negentropy.rs b/tests/nip77_negentropy.rs index c8e0b50..5293754 100644 --- a/tests/nip77_negentropy.rs +++ b/tests/nip77_negentropy.rs | |||
| @@ -45,13 +45,13 @@ async fn test_nip77_negentropy_sync_finds_events() { | |||
| 45 | let keys = Keys::generate(); | 45 | let keys = Keys::generate(); |
| 46 | 46 | ||
| 47 | // Create a repository announcement that will be accepted by the relay | 47 | // Create a repository announcement that will be accepted by the relay |
| 48 | let announcement = create_repo_announcement( | 48 | let announcement = create_repo_announcement(&keys, &[&relay.domain()], "test-repo-nip77"); |
| 49 | &keys, | ||
| 50 | &[&relay.domain()], | ||
| 51 | "test-repo-nip77", | ||
| 52 | ); | ||
| 53 | let event1_id = announcement.id; | 49 | let event1_id = announcement.id; |
| 54 | println!("Created event 1: {} (kind {})", event1_id, announcement.kind.as_u16()); | 50 | println!( |
| 51 | "Created event 1: {} (kind {})", | ||
| 52 | event1_id, | ||
| 53 | announcement.kind.as_u16() | ||
| 54 | ); | ||
| 55 | 55 | ||
| 56 | // Create a second event (issue referencing the repo) | 56 | // Create a second event (issue referencing the repo) |
| 57 | let repo_coord = format!( | 57 | let repo_coord = format!( |
| @@ -63,7 +63,11 @@ async fn test_nip77_negentropy_sync_finds_events() { | |||
| 63 | let issue = build_layer2_issue_event(&keys, &repo_coord, "Test issue for NIP-77") | 63 | let issue = build_layer2_issue_event(&keys, &repo_coord, "Test issue for NIP-77") |
| 64 | .expect("Failed to build issue event"); | 64 | .expect("Failed to build issue event"); |
| 65 | let event2_id = issue.id; | 65 | let event2_id = issue.id; |
| 66 | println!("Created event 2: {} (kind {})", event2_id, issue.kind.as_u16()); | 66 | println!( |
| 67 | "Created event 2: {} (kind {})", | ||
| 68 | event2_id, | ||
| 69 | issue.kind.as_u16() | ||
| 70 | ); | ||
| 67 | 71 | ||
| 68 | // 3. Send events to relay using TestClient | 72 | // 3. Send events to relay using TestClient |
| 69 | let publish_client = TestClient::new(relay.url(), keys.clone()) | 73 | let publish_client = TestClient::new(relay.url(), keys.clone()) |
| @@ -99,9 +103,10 @@ async fn test_nip77_negentropy_sync_finds_events() { | |||
| 99 | tokio::time::sleep(Duration::from_millis(500)).await; | 103 | tokio::time::sleep(Duration::from_millis(500)).await; |
| 100 | 104 | ||
| 101 | // 6. Perform negentropy sync with filter matching our events | 105 | // 6. Perform negentropy sync with filter matching our events |
| 102 | let filter = Filter::new() | 106 | let filter = Filter::new().author(keys.public_key()).kinds(vec![ |
| 103 | .author(keys.public_key()) | 107 | Kind::Custom(KIND_REPOSITORY_STATE), |
| 104 | .kinds(vec![Kind::Custom(KIND_REPOSITORY_STATE), Kind::Custom(KIND_ISSUE)]); | 108 | Kind::Custom(KIND_ISSUE), |
| 109 | ]); | ||
| 105 | 110 | ||
| 106 | println!("Starting negentropy sync with filter: {:?}", filter); | 111 | println!("Starting negentropy sync with filter: {:?}", filter); |
| 107 | 112 | ||
| @@ -177,7 +182,7 @@ async fn test_nip77_negentropy_sync_empty_result() { | |||
| 177 | 182 | ||
| 178 | // 3. Sync with filter that won't match anything | 183 | // 3. Sync with filter that won't match anything |
| 179 | let filter = Filter::new() | 184 | let filter = Filter::new() |
| 180 | .author(keys.public_key()) // Random new key, no events exist | 185 | .author(keys.public_key()) // Random new key, no events exist |
| 181 | .kind(Kind::Custom(KIND_REPOSITORY_STATE)); | 186 | .kind(Kind::Custom(KIND_REPOSITORY_STATE)); |
| 182 | 187 | ||
| 183 | println!("Starting negentropy sync with empty filter"); | 188 | println!("Starting negentropy sync with empty filter"); |