refactor: delete entry services refactoring #191
Closed
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.
This PR refactors delete operations in controllers/entry into separate functions and moves them to a new file /models/services/entry/entry.ts. It also adds unit tests for the delete service functions.
In order to test deletes with the memory mongodb, I needed to deploy it as a replica set instead of as a standalone instance. This required changes to jest.setup.cjs. Although all unit tests pass, occasionally on teardown, the following error will appear:
This doesn't seem to affect anything, but I haven't been able to figure out why exactly it's happening. My best guess is that jest closes before every node in the replica set disconnects. This doesn't break anything, and it doesn't even affect the unit tests because it happens after they all finish running, but it's odd.