The Cognitive Distortion Journal (CDJ) is a smart journaling tool that helps remedy distorted thinking. It can feel impossible to follow the CBT technique of labeling and reframing distorted thinking when you've been thinking this way your whole life. The CDJ can help with that 🧠✨ -- v2 is in development!
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:
Ran all test suites.
Teardown: Dropping test database...
Error: read ECONNRESET
at TCP.onStreamRead (node:internal/stream_base_commons:218:20) {
errno: -4077,
code: 'ECONNRESET',
syscall: 'read'
}
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.
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.