Problem
parseServerIdentity accepts three externally supplied identity formats—hex pubkeys, npub, and nprofile—but currently has no focused unit tests. A regression here can prevent the client transport from starting or silently discard relay hints.
Scope
Add src/transport/nostr-client/server-identity.test.ts covering:
- a valid 64-character hex pubkey;
- uppercase or mixed-case hex if supported by the existing contract;
- a valid
npub identity;
- a valid
nprofile identity with relay hints;
- an
nprofile without relay hints;
- malformed, unsupported, and empty input;
- the stable transport-facing error message for invalid input.
Use nostr-tools encoders to build valid Bech32 fixtures rather than hard-coding opaque values where practical.
Non-goals
- Do not add new identity formats.
- Do not change relay discovery or connection behavior.
- Keep production changes out of scope unless a test exposes a confirmed defect.
Acceptance criteria
- Tests exercise all three documented input formats and the common error path.
- Tests are deterministic and make no relay or network calls.
- Existing tests, lint, and type checking continue to pass.
Verification
bun test src/transport/nostr-client/server-identity.test.ts
bun lint
bun typecheck
Problem
parseServerIdentityaccepts three externally supplied identity formats—hex pubkeys,npub, andnprofile—but currently has no focused unit tests. A regression here can prevent the client transport from starting or silently discard relay hints.Scope
Add
src/transport/nostr-client/server-identity.test.tscovering:npubidentity;nprofileidentity with relay hints;nprofilewithout relay hints;Use
nostr-toolsencoders to build valid Bech32 fixtures rather than hard-coding opaque values where practical.Non-goals
Acceptance criteria
Verification
bun test src/transport/nostr-client/server-identity.test.ts bun lint bun typecheck