Skip to content

test: integration tests for NIP-17 Gift Wrap (Kind 1059) validation #504

Description

@phoenix-server

Summary

NIP-17 private direct messages use a gift wrap envelope (kind 1059) with NIP-44 encrypted content. The GiftWrapEventStrategy enforces structural rules but there are no integration tests exercising these validations end-to-end.

What to test

  • Gift wrap with exactly one p tag and valid NIP-44 content → accepted (OK)
  • Gift wrap with no p tag → rejected with invalid: gift wrap event (kind 1059) must have a p tag...
  • Gift wrap with more than one p tag → rejected with invalid: gift wrap event (kind 1059) must have exactly one p tag
  • Gift wrap with a malformed NIP-44 payload → rejected with invalid: gift wrap content must be a valid NIP-44 v2 payload...
  • Recipient can query their gift wraps via #p tag filter

Relevant code

  • src/handlers/event-strategies/gift-wrap-event-strategy.ts
  • src/utils/nip44.ts
  • src/constants/base.tsEventKinds.GIFT_WRAP, EventKinds.SEAL, EventKinds.DIRECT_MESSAGE

Suggested location

test/integration/features/nip-17/nip-17.feature

Metadata

Metadata

Labels

testUnit or integration test improvements

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions