Repository navigation
test: zone_record routes survive a leftover row - #76
Merged
Merged
Conversation
There was a problem hiding this comment.
🟡 Changes recommended
Cleanup can delete legitimate data, and the fallback does not await database disconnection.
2 open findings
What changed in this PR
Improves zone-record route-test cleanup after stale fixtures or setup failures.
Changes:
- Removes the bystander fixture before setup.
- Disconnects the database when server initialization fails.
| File | Description |
|---|---|
routes/zone_record.test.js |
Updates fixture cleanup and failed-setup teardown. |
🧠 Review effort: Balanced
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
|
|
||
| before(async () => { | ||
| await ZoneRecord.destroy({ id: testZoneRecordId }) | ||
| await ZoneRecord.destroy({ id: bystanderId }) |
| await server.stop() | ||
| // a failed before() leaves no server, and an open db connection keeps node running | ||
| if (server) await server.stop() | ||
| else await ZoneRecord.disconnect() |
msimerson
added a commit
to aberoham/api
that referenced
this pull request
Oct 14, 2026
routes/zone_record.test.js (NicTool#76) awaits ZoneRecord.disconnect() after a failed setup; without the return, that await settled before the connection closed. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
msimerson
added a commit
to aberoham/api
that referenced
this pull request
Oct 14, 2026
routes/zone_record.test.js (NicTool#76) awaits ZoneRecord.disconnect() after a failed setup; without the return, that await settled before the connection closed.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.


One leftover zone record with id 5097 makes
routes/zone_record.test.jsrun forever.before()destroys the test record and zone, but not the bystander record it creates next. SoZoneRecord.create()throws a conflict.after()then callsstop()on a server that never started. The open db connection keeps node running.Both halves came from my PRs on Aug 30. #71 added the bystander, and #69 made
create()reject an existing id instead of returning it.A crashed earlier run leaves that row behind, and so does a restored production db that has a record at 5097.
before()now destroys the bystander first. If setup still fails,after()closes the db connection so the file fails instead of hanging.