From 652c5913f695ba7e8dfd78cd0cbe5cc3de67fa59 Mon Sep 17 00:00:00 2001 From: DanConwayDev Date: Tue, 4 Nov 2025 21:58:23 +0000 Subject: test: migrate to TestRelay fixture pattern and add compliance docs - Remove unnecessary 'nix' dev dependency (Unix syscalls crate, not needed) - Migrate announcement tests to new TestRelay fixture pattern - Delete legacy test files (announcement_tests.rs, test_relay.sh) - Add comprehensive test documentation (docs/how-to/test-compliance.md) - Update README.md with new test commands - All 18 integration tests passing (NIP-01 + NIP-34) Benefits: - Automatic relay lifecycle management - No manual setup required - Pure Rust integration tests - Better developer experience - CI/CD ready --- README.md | 33 ++++++++++++++++++++------------- 1 file changed, 20 insertions(+), 13 deletions(-) (limited to 'README.md') diff --git a/README.md b/README.md index 0d454bc..2418d14 100644 --- a/README.md +++ b/README.md @@ -129,17 +129,28 @@ We have two test suites: # Run unit tests (no external dependencies) nix develop -c cargo test --lib -# Run integration tests (tests our relay implementation) -# First, start ngit-grasp relay in one terminal: -NGIT_BIND_ADDRESS=127.0.0.1:7000 nix develop -c cargo run +# Run all integration tests (automatic relay management) +nix develop -c cargo test --test nip01_compliance --test nip34_announcements -# Then in another terminal, run integration tests: -nix develop -c cargo test --test announcement_tests --ignored +# Run NIP-01 compliance tests +nix develop -c cargo test --test nip01_compliance -# Or use the test script (starts relay automatically): -./test_relay.sh +# Run NIP-34 announcement tests +nix develop -c cargo test --test nip34_announcements + +# With detailed output +nix develop -c cargo test --test nip01_compliance -- --nocapture + +# Run specific test +nix develop -c cargo test --test nip01_compliance test_nip01_smoke ``` +**Integration tests automatically:** +- Start a fresh relay instance +- Run compliance tests using grasp-audit library +- Clean up when done +- No manual relay management needed! + **2. GRASP Audit Tool (grasp-audit)** The audit tool tests GRASP compliance of any relay (including ours or external ones). @@ -151,12 +162,8 @@ cd grasp-audit # Run unit tests nix develop -c cargo test -# Test against our ngit-grasp relay: -# First, start ngit-grasp (in another terminal): -cd .. && NGIT_BIND_ADDRESS=127.0.0.1:7000 nix develop -c cargo run - -# Then run audit: -nix develop -c cargo run -- --url ws://127.0.0.1:7000 +# Test against any relay (including external ones) +nix develop -c cargo run -- --url wss://relay.example.com # Or test against any external relay: nix develop -c cargo run -- --url wss://relay.example.com -- cgit v1.2.3