Skip to content

test: add comprehensive unit tests for discovery-tags.ts#62

Open
DevAnuragT wants to merge 1 commit intoContextVM:masterfrom
DevAnuragT:test/discovery-tags
Open

test: add comprehensive unit tests for discovery-tags.ts#62
DevAnuragT wants to merge 1 commit intoContextVM:masterfrom
DevAnuragT:test/discovery-tags

Conversation

@DevAnuragT
Copy link
Copy Markdown
Contributor

Description

This PR introduces comprehensive unit tests for src/transport/discovery-tags.ts.

By establishing 100% test coverage now, this effectively locks down the current capability parsing behavior (used for CEP-15/17/19 discovery) and provides a safe foundation before extending the module to parse the upcoming CEP-15 D/I (defines/implements) schema tags.

Changes Made

  • Test Suite Added: Created src/transport/discovery-tags.test.ts co-located with the source file.
  • 100% Coverage: Verified 100% line and function coverage across all methods (hasSingleTag, hasEventTag, getDiscoveryTags, parseDiscoveredPeerCapabilities, learnPeerCapabilities, mergeDiscoveryTags).
  • Edge Cases Handled: Added defensive checks for undefined inputs, empty arrays, missing tags, and unknown tags.
  • Immutability Verified: Added strict assertions to verify array cloning behavior and prevent unintended reference mutations.
  • Style Alignment: Followed the established conventions from announcement-manager.test.ts using native bun:test and existing project constants.

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant