Summary
Add unit and integration tests for the did:nostr → WebID resolution feature added in v0.0.58.
Test Coverage Needed
Unit Tests (src/auth/did-nostr.js)
-
resolveDidNostrToWebId()
- Returns null for invalid pubkey
- Returns null when DID document not found (404)
- Returns null when no alsoKnownAs in DID doc
- Returns null when WebID doesn't link back (no bidirectional proof)
- Returns WebID when bidirectional link exists
- Caches results for 5 minutes
- Handles network timeouts gracefully
-
checkSameAsLink()
- Finds
owl:sameAs string value
- Finds
sameAs string value
- Finds
owl:sameAs as object with @id
- Finds sameAs in array
- Case-insensitive DID matching
Integration Tests
- Full flow: Nostr NIP-98 auth → DID resolution → WebID authentication
- Mock nostr.social DID endpoint
- Verify fallback to did:nostr when no WebID linked
Files
test/did-nostr.test.js (new)
- Update
test/auth.test.js if needed
Summary
Add unit and integration tests for the did:nostr → WebID resolution feature added in v0.0.58.
Test Coverage Needed
Unit Tests (src/auth/did-nostr.js)
resolveDidNostrToWebId()checkSameAsLink()owl:sameAsstring valuesameAsstring valueowl:sameAsas object with@idIntegration Tests
Files
test/did-nostr.test.js(new)test/auth.test.jsif needed