Skip to content

test(transport): cover ServerMetadataStore lifecycle #85

Description

@1amKhush

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

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions