diff options
| author | DanConwayDev <DanConwayDev@protonmail.com> | 2025-11-20 22:15:03 +0000 |
|---|---|---|
| committer | DanConwayDev <DanConwayDev@protonmail.com> | 2025-11-20 22:20:28 +0000 |
| commit | 519fdc66930280cd1772417dca327ed858333d64 (patch) | |
| tree | 4b20e18ccbc7406106bc72316dc3e26f2b58495f /grasp-audit/src/specs/grasp01/nip01_smoke.rs | |
| parent | ca50f5b98f30d0933a510c05db86b608afee73a0 (diff) | |
refactor: isolate each grasp-audit lib test with minimal boilerplate
- Add isolated_test! macro pattern to nip34_announcements.rs and nip01_compliance.rs
- Each test runs with its own fresh relay instance for complete isolation
- Make all individual test functions public in grasp-audit library (nip01_smoke.rs, event_acceptance_policy.rs)
- Eliminates 122 lines of boilerplate across integration tests
- Tests: 15 GRASP-01 event acceptance policy tests + 6 NIP-01 smoke tests
- Ensures tests don't interfere with each other, preventing flakiness
Diffstat (limited to 'grasp-audit/src/specs/grasp01/nip01_smoke.rs')
| -rw-r--r-- | grasp-audit/src/specs/grasp01/nip01_smoke.rs | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/grasp-audit/src/specs/grasp01/nip01_smoke.rs b/grasp-audit/src/specs/grasp01/nip01_smoke.rs index 204ee60..79220e5 100644 --- a/grasp-audit/src/specs/grasp01/nip01_smoke.rs +++ b/grasp-audit/src/specs/grasp01/nip01_smoke.rs | |||
| @@ -29,7 +29,7 @@ impl Nip01SmokeTests { | |||
| 29 | /// | 29 | /// |
| 30 | /// Spec: NIP-01 basic requirement | 30 | /// Spec: NIP-01 basic requirement |
| 31 | /// Requirement: MUST serve a relay at / via WebSocket | 31 | /// Requirement: MUST serve a relay at / via WebSocket |
| 32 | async fn test_websocket_connection(client: &AuditClient) -> TestResult { | 32 | pub async fn test_websocket_connection(client: &AuditClient) -> TestResult { |
| 33 | TestResult::new( | 33 | TestResult::new( |
| 34 | "websocket_connection", | 34 | "websocket_connection", |
| 35 | "NIP-01:basic", | 35 | "NIP-01:basic", |
| @@ -52,7 +52,7 @@ impl Nip01SmokeTests { | |||
| 52 | /// | 52 | /// |
| 53 | /// For GRASP servers, we send a NIP-34 repository announcement that lists | 53 | /// For GRASP servers, we send a NIP-34 repository announcement that lists |
| 54 | /// the GRASP server in clone and relays tags (required for acceptance). | 54 | /// the GRASP server in clone and relays tags (required for acceptance). |
| 55 | async fn test_send_receive_event(client: &AuditClient) -> TestResult { | 55 | pub async fn test_send_receive_event(client: &AuditClient) -> TestResult { |
| 56 | TestResult::new( | 56 | TestResult::new( |
| 57 | "send_receive_event", | 57 | "send_receive_event", |
| 58 | "NIP-01:event-message", | 58 | "NIP-01:event-message", |
| @@ -123,7 +123,7 @@ impl Nip01SmokeTests { | |||
| 123 | /// | 123 | /// |
| 124 | /// Spec: NIP-01 REQ message | 124 | /// Spec: NIP-01 REQ message |
| 125 | /// Requirement: Relay MUST support REQ subscriptions | 125 | /// Requirement: Relay MUST support REQ subscriptions |
| 126 | async fn test_create_subscription(client: &AuditClient) -> TestResult { | 126 | pub async fn test_create_subscription(client: &AuditClient) -> TestResult { |
| 127 | TestResult::new( | 127 | TestResult::new( |
| 128 | "create_subscription", | 128 | "create_subscription", |
| 129 | "NIP-01:req-message", | 129 | "NIP-01:req-message", |
| @@ -165,7 +165,7 @@ impl Nip01SmokeTests { | |||
| 165 | /// | 165 | /// |
| 166 | /// Spec: NIP-01 CLOSE message | 166 | /// Spec: NIP-01 CLOSE message |
| 167 | /// Requirement: Relay MUST support CLOSE to end subscriptions | 167 | /// Requirement: Relay MUST support CLOSE to end subscriptions |
| 168 | async fn test_close_subscription(client: &AuditClient) -> TestResult { | 168 | pub async fn test_close_subscription(client: &AuditClient) -> TestResult { |
| 169 | TestResult::new( | 169 | TestResult::new( |
| 170 | "close_subscription", | 170 | "close_subscription", |
| 171 | "NIP-01:close-message", | 171 | "NIP-01:close-message", |
| @@ -193,7 +193,7 @@ impl Nip01SmokeTests { | |||
| 193 | /// | 193 | /// |
| 194 | /// Spec: NIP-01 event validation | 194 | /// Spec: NIP-01 event validation |
| 195 | /// Requirement: Relay MUST reject events with invalid signatures | 195 | /// Requirement: Relay MUST reject events with invalid signatures |
| 196 | async fn test_reject_invalid_signature(client: &AuditClient) -> TestResult { | 196 | pub async fn test_reject_invalid_signature(client: &AuditClient) -> TestResult { |
| 197 | TestResult::new( | 197 | TestResult::new( |
| 198 | "reject_invalid_signature", | 198 | "reject_invalid_signature", |
| 199 | "NIP-01:validation", | 199 | "NIP-01:validation", |
| @@ -247,7 +247,7 @@ impl Nip01SmokeTests { | |||
| 247 | /// | 247 | /// |
| 248 | /// Spec: NIP-01 event ID validation | 248 | /// Spec: NIP-01 event ID validation |
| 249 | /// Requirement: Relay MUST reject events where ID doesn't match hash | 249 | /// Requirement: Relay MUST reject events where ID doesn't match hash |
| 250 | async fn test_reject_invalid_event_id(client: &AuditClient) -> TestResult { | 250 | pub async fn test_reject_invalid_event_id(client: &AuditClient) -> TestResult { |
| 251 | TestResult::new( | 251 | TestResult::new( |
| 252 | "reject_invalid_event_id", | 252 | "reject_invalid_event_id", |
| 253 | "NIP-01:validation", | 253 | "NIP-01:validation", |