Problem
ServerMetadataStore owns client-side discovery metadata and negotiated feature state, but it does not have a focused unit test suite. Its clear() behavior and parsing fallbacks are especially important when a transport is reused or reconnects.
Scope
Add src/transport/nostr-client/server-metadata-store.test.ts covering the existing behavior:
- initialize-event storage and retrieval;
- valid and invalid
InitializeResult parsing;
- tool, resource, resource-template, and prompt list envelope storage;
- oversized-transfer and open-stream support flags;
- effective payment-interaction state;
- name, about, website, picture, and encryption tags;
clear() resetting every stored event, flag, and negotiated value.
Reuse existing Nostr event fixtures or add a small local fixture builder in the test file.
Non-goals
- Do not change transport lifecycle or protocol negotiation behavior.
- Do not add new metadata fields.
- Keep production changes out of scope unless a test exposes a confirmed defect.
Acceptance criteria
- Tests cover both populated and empty/default store state.
- 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-metadata-store.test.ts
bun lint
bun typecheck
Problem
ServerMetadataStoreowns client-side discovery metadata and negotiated feature state, but it does not have a focused unit test suite. Itsclear()behavior and parsing fallbacks are especially important when a transport is reused or reconnects.Scope
Add
src/transport/nostr-client/server-metadata-store.test.tscovering the existing behavior:InitializeResultparsing;clear()resetting every stored event, flag, and negotiated value.Reuse existing Nostr event fixtures or add a small local fixture builder in the test file.
Non-goals
Acceptance criteria
Verification
bun test src/transport/nostr-client/server-metadata-store.test.ts bun lint bun typecheck