From 519fdc66930280cd1772417dca327ed858333d64 Mon Sep 17 00:00:00 2001 From: DanConwayDev Date: Thu, 20 Nov 2025 22:15:03 +0000 Subject: 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 --- grasp-audit/src/specs/grasp01/nip01_smoke.rs | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'grasp-audit/src/specs/grasp01/nip01_smoke.rs') 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 { /// /// Spec: NIP-01 basic requirement /// Requirement: MUST serve a relay at / via WebSocket - async fn test_websocket_connection(client: &AuditClient) -> TestResult { + pub async fn test_websocket_connection(client: &AuditClient) -> TestResult { TestResult::new( "websocket_connection", "NIP-01:basic", @@ -52,7 +52,7 @@ impl Nip01SmokeTests { /// /// For GRASP servers, we send a NIP-34 repository announcement that lists /// the GRASP server in clone and relays tags (required for acceptance). - async fn test_send_receive_event(client: &AuditClient) -> TestResult { + pub async fn test_send_receive_event(client: &AuditClient) -> TestResult { TestResult::new( "send_receive_event", "NIP-01:event-message", @@ -123,7 +123,7 @@ impl Nip01SmokeTests { /// /// Spec: NIP-01 REQ message /// Requirement: Relay MUST support REQ subscriptions - async fn test_create_subscription(client: &AuditClient) -> TestResult { + pub async fn test_create_subscription(client: &AuditClient) -> TestResult { TestResult::new( "create_subscription", "NIP-01:req-message", @@ -165,7 +165,7 @@ impl Nip01SmokeTests { /// /// Spec: NIP-01 CLOSE message /// Requirement: Relay MUST support CLOSE to end subscriptions - async fn test_close_subscription(client: &AuditClient) -> TestResult { + pub async fn test_close_subscription(client: &AuditClient) -> TestResult { TestResult::new( "close_subscription", "NIP-01:close-message", @@ -193,7 +193,7 @@ impl Nip01SmokeTests { /// /// Spec: NIP-01 event validation /// Requirement: Relay MUST reject events with invalid signatures - async fn test_reject_invalid_signature(client: &AuditClient) -> TestResult { + pub async fn test_reject_invalid_signature(client: &AuditClient) -> TestResult { TestResult::new( "reject_invalid_signature", "NIP-01:validation", @@ -247,7 +247,7 @@ impl Nip01SmokeTests { /// /// Spec: NIP-01 event ID validation /// Requirement: Relay MUST reject events where ID doesn't match hash - async fn test_reject_invalid_event_id(client: &AuditClient) -> TestResult { + pub async fn test_reject_invalid_event_id(client: &AuditClient) -> TestResult { TestResult::new( "reject_invalid_event_id", "NIP-01:validation", -- cgit v1.2.3