upleb.uk

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

summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorDanConwayDev <DanConwayDev@protonmail.com>2025-11-21 04:44:40 +0000
committerDanConwayDev <DanConwayDev@protonmail.com>2025-11-21 04:44:40 +0000
commit7dda553918705277c7fa5b903c6a40e4b4a0aa8d (patch)
tree4f3511cd3fe56928bd2aa9a22f4ddd592f4c6b83 /tests
parent2e799fa7ec57d284c643df8b8dc54471470f5c59 (diff)
add nip11
Diffstat (limited to 'tests')
-rw-r--r--tests/nip11_document.rs62
1 files changed, 62 insertions, 0 deletions
diff --git a/tests/nip11_document.rs b/tests/nip11_document.rs
new file mode 100644
index 0000000..da8e9ce
--- /dev/null
+++ b/tests/nip11_document.rs
@@ -0,0 +1,62 @@
1//! GRASP-01 NIP-11 Document Integration Tests
2//!
3//! Tests ngit-grasp relay's implementation of GRASP-01 NIP-11 relay information requirements.
4//! Uses grasp-audit library to avoid code duplication.
5//!
6//! # Test Strategy
7//!
8//! - Each test runs in complete isolation with its own fresh relay instance
9//! - Uses macro to eliminate boilerplate while maintaining test isolation
10//! - Calls individual test methods from grasp-audit for minimal duplication
11//!
12//! # Running Tests
13//!
14//! ```bash
15//! # Run all GRASP-01 NIP-11 tests
16//! cargo test --test nip11_document
17//!
18//! # Run specific test
19//! cargo test --test nip11_document test_nip11_document_exists
20//!
21//! # With output
22//! cargo test --test nip11_document -- --nocapture
23//! ```
24
25mod common;
26
27use common::TestRelay;
28use grasp_audit::*;
29
30/// Macro to generate isolated integration tests
31///
32/// Each test runs with its own fresh relay instance to ensure complete isolation.
33/// This eliminates rate-limiting issues and ensures tests don't interfere with each other.
34macro_rules! isolated_test {
35 ($test_name:ident) => {
36 #[tokio::test]
37 async fn $test_name() {
38 let relay = TestRelay::start().await;
39 let config = AuditConfig::ci();
40 let client = AuditClient::new(relay.url(), config)
41 .await
42 .expect("Failed to create audit client");
43
44 let result = specs::Nip11DocumentTests::$test_name(&client).await;
45
46 relay.stop().await;
47
48 assert!(
49 result.passed,
50 "{} failed: {}",
51 stringify!($test_name),
52 result.error.as_deref().unwrap_or("unknown error")
53 );
54 }
55 };
56}
57
58// Generate isolated tests for all GRASP-01 NIP-11 document tests
59isolated_test!(test_nip11_document_exists);
60isolated_test!(test_nip11_supported_grasps_field);
61isolated_test!(test_nip11_repo_acceptance_criteria_field);
62isolated_test!(test_nip11_curation_field); \ No newline at end of file