test(integration): add NIP-62 vanish tests and fix test enviroment#537
Conversation
There was a problem hiding this comment.
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.
| 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]) | ||
|
|
There was a problem hiding this comment.
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.
| if (!event) { | |
| throw new Error(`No draft event found for ${name}`) | |
| } |
| await new Promise<void>((resolve) => { | ||
| if (!worker) { | ||
| void Promise.all(clients.map((client) => client.destroy())).then(() => resolve()) | ||
| return |
There was a problem hiding this comment.
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).
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?
test/integration/features/nip-62Types of changes
Checklist: