diff options
| author | DanConwayDev <DanConwayDev@protonmail.com> | 2026-01-08 11:20:35 +0000 |
|---|---|---|
| committer | DanConwayDev <DanConwayDev@protonmail.com> | 2026-01-08 11:23:28 +0000 |
| commit | 5d02ad6b893f9059044914c115d77cf9d8e589c3 (patch) | |
| tree | b727f9c44d2f2d4e203dc2344e4c9bd5144a77dd /grasp-audit/src/specs/grasp01/nip01_smoke.rs | |
| parent | 075307804bf66bba10f5bc55cb40e2e6a98a65ee (diff) | |
refactor: replace hardcoded Kind constants with rust-nostr variants
- Replace KIND_REPOSITORY_ANNOUNCEMENT with Kind::GitRepoAnnouncement
- Replace KIND_REPOSITORY_STATE with Kind::RepoState
- Replace KIND_PR with Kind::GitPullRequest
- Replace KIND_PR_UPDATE with Kind::GitPullRequestUpdate
- Replace KIND_USER_GRASP_LIST with Kind::GitUserGraspList
- Replace KIND_PATCH with Kind::GitPatch
- Replace KIND_ISSUE with Kind::GitIssue
- Replace KIND_COMMENT with Kind::Comment
- Replace all Kind::Custom(30617|30618|1617|1618|1619|1621|1111|10317) patterns
- Remove all hardcoded KIND_* constants from events.rs
- Update all match statements to use Kind enum directly
- Update all filter builders to use Kind variants
- Update all test helpers and assertions
Benefits:
- Type safety: compiler prevents wrong kind numbers
- Readability: Kind::GitRepoAnnouncement is self-documenting
- Maintainability: single source of truth (rust-nostr)
- IDE support: full autocompletion and refactoring
- Standards: aligns with rust-nostr best practices
Files modified: 21
Constants removed: 9
Patterns replaced: 100+
Tests passing: 222/222
Diffstat (limited to 'grasp-audit/src/specs/grasp01/nip01_smoke.rs')
| -rw-r--r-- | grasp-audit/src/specs/grasp01/nip01_smoke.rs | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/grasp-audit/src/specs/grasp01/nip01_smoke.rs b/grasp-audit/src/specs/grasp01/nip01_smoke.rs index bd45ea4..4d0b8a4 100644 --- a/grasp-audit/src/specs/grasp01/nip01_smoke.rs +++ b/grasp-audit/src/specs/grasp01/nip01_smoke.rs | |||
| @@ -78,7 +78,7 @@ impl Nip01SmokeTests { | |||
| 78 | tokio::time::sleep(std::time::Duration::from_millis(100)).await; | 78 | tokio::time::sleep(std::time::Duration::from_millis(100)).await; |
| 79 | 79 | ||
| 80 | // Step 2: VERIFY - Query event back | 80 | // Step 2: VERIFY - Query event back |
| 81 | let filter = Filter::new().kind(Kind::Custom(30617)).id(event_id); | 81 | let filter = Filter::new().kind(Kind::GitRepoAnnouncement).id(event_id); |
| 82 | 82 | ||
| 83 | let events = client | 83 | let events = client |
| 84 | .query(filter) | 84 | .query(filter) |
| @@ -88,7 +88,7 @@ impl Nip01SmokeTests { | |||
| 88 | if events.is_empty() { | 88 | if events.is_empty() { |
| 89 | // Debug: try querying without audit client filtering | 89 | // Debug: try querying without audit client filtering |
| 90 | eprintln!("Event not found with audit client query, trying direct client query..."); | 90 | eprintln!("Event not found with audit client query, trying direct client query..."); |
| 91 | let direct_filter = Filter::new().kind(Kind::Custom(30617)).id(event_id); | 91 | let direct_filter = Filter::new().kind(Kind::GitRepoAnnouncement).id(event_id); |
| 92 | let direct_events = client | 92 | let direct_events = client |
| 93 | .client() | 93 | .client() |
| 94 | .fetch_events(direct_filter, std::time::Duration::from_secs(5)) | 94 | .fetch_events(direct_filter, std::time::Duration::from_secs(5)) |
| @@ -140,7 +140,7 @@ impl Nip01SmokeTests { | |||
| 140 | 140 | ||
| 141 | // Step 2: VERIFY - Subscribe to NIP-34 announcements from this author | 141 | // Step 2: VERIFY - Subscribe to NIP-34 announcements from this author |
| 142 | let filter = Filter::new() | 142 | let filter = Filter::new() |
| 143 | .kind(Kind::Custom(30617)) | 143 | .kind(Kind::GitRepoAnnouncement) |
| 144 | .author(client.public_key()); | 144 | .author(client.public_key()); |
| 145 | 145 | ||
| 146 | let events = client | 146 | let events = client |