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!
There are some issues around testing the API and passport. Currently determining if the issue is due to a bug in the controller and middleware code or in the setup of the tests itself. It seemingly is due to the test setup. Working through this issue with ChatGPT in two conversations.
Some things to look into is how passport is being used in the controllers and middleware. Incorrect usage may be causing these errors. Another thing is that passport may be trying to use the development test base which is not active in a testing environment (the test version of the database is) to authenticate/authorize a user so another passport strategy may be required to be setup.
Tests are being made to replicate the following curl commands that were used to manually test the API that verifies the the endpoints are working as expected. See API docs in backend for more details.
Testing Entries API
Attempt to Retrieve All Journal Entries
curl -X GET http://localhost:3000/journals/65619e89bba77f3e6cff9580/entries
Attempts to retrieve all entries from the specified journal without authentication.
Attempt to Add a New Journal Entry
curl -X POST http://localhost:3000/journals/65619e89bba77f3e6cff9580/entries \
-H "Content-Type: application/json" \
-d '{"title": "Test Entry", "content": "This is a test entry."}'
Tries to add a new entry to the specified journal without authentication.
Attempt to Retrieve a Specific Journal Entry
curl -X GET http://localhost:3000/journals/65619e89bba77f3e6cff9580/entries/65619e89bba77f3e6cff9582
Attempts to retrieve the specified journal entry without authentication.
There are some issues around testing the API and passport. Currently determining if the issue is due to a bug in the controller and middleware code or in the setup of the tests itself. It seemingly is due to the test setup. Working through this issue with ChatGPT in two conversations.
CDJ Troubleshoot Test Setup Issues CDJ TDD
Some things to look into is how passport is being used in the controllers and middleware. Incorrect usage may be causing these errors. Another thing is that passport may be trying to use the development test base which is not active in a testing environment (the test version of the database is) to authenticate/authorize a user so another passport strategy may be required to be setup.
Tests are being made to replicate the following curl commands that were used to manually test the API that verifies the the endpoints are working as expected. See API docs in backend for more details.
Testing Entries API
Attempts to retrieve all entries from the specified journal without authentication.
Tries to add a new entry to the specified journal without authentication.
Attempts to retrieve the specified journal entry without authentication.
Tries to update the specified journal entry without authentication.
Attempts to delete the specified journal entry without authentication.
Testing Access API
Registers a new user with valid credentials.
Attempts to log in with valid credentials.
Attempts to log in with a valid email but incorrect password.
Attempts to log in with an incorrect email and valid password.
Logs out the currently authenticated user.
Attempts to register a user with an already existing email.
Attempts to log out when no user is logged in.