Skip to content

test(integration): add NIP-62 vanish tests and fix test enviroment#537

Merged
cameri merged 7 commits intocameri:mainfrom
vikashsiwach:test/nip62-vanish-integration
Apr 19, 2026
Merged

test(integration): add NIP-62 vanish tests and fix test enviroment#537
cameri merged 7 commits intocameri:mainfrom
vikashsiwach:test/nip62-vanish-integration

Conversation

@vikashsiwach
Copy link
Copy Markdown
Collaborator

Description

This PR adds integration test coverage for NIP-62(Request to Vanish) and stabilize the integration test environment setup.

Related Issue

Close issue #503

Motivation and Context

Kind62 (Request to Vanish) is a destructive and irreversible operation but lacked integration test coverage.This PR ensures the behavior is validated end-to-end.

How Has This Been Tested?

  • Added new integration tests under:
    test/integration/features/nip-62
  • Verified:
    • Events are deleted after vanish request.
    • Only the vanish request in returned in subsequent subscriptions.
    • Further publishing from the same pubkey is rejected.
  • Ran full test suite:
    • Unit test : all passing (906 tests)
    • Integration tests : passing locally with Docker.

Types of changes

  • Non-functional change (docs, style, minor refactor)
  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)

Checklist:

  • My code follows the code style of this project.
  • My change requires a change to the documentation.
  • I have updated the documentation accordingly.
  • I have read the CONTRIBUTING document.
  • I have added tests to cover my code changes.
  • I added a changeset, or this is docs-only and I added an empty changeset.
  • All new and existing tests passed.

@coveralls
Copy link
Copy Markdown
Collaborator

coveralls commented Apr 19, 2026

Coverage Status

coverage: 73.153% (+0.1%) from 73.05% — vikashsiwach:test/nip62-vanish-integration into cameri:main

@cameri cameri self-assigned this Apr 19, 2026
@cameri cameri requested a review from Copilot April 19, 2026 21:12
Comment thread test/integration/features/shared.ts Outdated
Comment thread test/integration/features/shared.ts Outdated
Comment thread test/integration/features/shared.ts Outdated
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds end-to-end integration coverage for NIP-62 (Request to Vanish) and makes the integration test environment setup/teardown more robust.

Changes:

  • Stabilize Cucumber integration test runtime by setting a higher default timeout and providing DB env defaults.
  • Add new NIP-62 Cucumber feature + step definitions to verify vanish deletion behavior and post-vanish publish rejection.
  • Add a Changesets entry for the patch release note.

Reviewed changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated 3 comments.

File Description
test/integration/features/shared.ts Increases default Cucumber timeout, sets DB env defaults for local runs, and improves DB client teardown logic.
test/integration/features/nip-62/nip-62.feature.ts Implements NIP-62 step definitions for sending vanish events and asserting post-vanish behavior.
test/integration/features/nip-62/nip-62.feature Adds scenarios verifying vanish deletion semantics and publish blocking after vanishing.
.changeset/nip-62-integration-tests.md Documents the change as a patch-level release note.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread test/integration/features/nip-62/nip-62.feature.ts Outdated
async function (name: string, reason: string) {
const ws = this.parameters.clients[name] as WebSocket
const event = this.parameters.events[name].findLast((event: Event) => event[isDraft])

Copy link

Copilot AI Apr 19, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

findLast(...) can return undefined if no draft event exists; delete event[isDraft] would then throw and fail the scenario with a non-actionable error. Add an explicit assertion/guard that a draft event was found before mutating/sending it.

Suggested change
if (!event) {
throw new Error(`No draft event found for ${name}`)
}

Copilot uses AI. Check for mistakes.
Comment thread test/integration/features/shared.ts Outdated
Comment on lines +63 to +66
await new Promise<void>((resolve) => {
if (!worker) {
void Promise.all(clients.map((client) => client.destroy())).then(() => resolve())
return
Copy link

Copilot AI Apr 19, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If client.destroy() rejects in this branch, the AfterAll promise never resolves/rejects, which can make the integration run hang until the timeout (and may surface as an unhandled rejection). Consider adding a .catch(reject)/try-catch so teardown failures fail fast and don’t stall the suite (same applies to the worker.close branch).

Copilot uses AI. Check for mistakes.
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.

4 participants