SDPCoachMe / SDP-2023

1 stars 0 forks source link

Message caching #115

Closed Luca-Engel closed 1 year ago

Luca-Engel commented 1 year ago

This pull request implements and tests the caching database methods for the in-app messaging part.

As the stale data prevention will be done in a separate task in this sprint, this has not yet been implemented so that it can be done in a unified way.

Testing:

To make tests clearer to understand and to test the caching functionality more easily, the MockDatabase has been refactored to be an open class so that classes can extend it. This allows us to overwrite certain methods of the MockDatabase (e.g., to allow us to see how many times they are called and to make sure that they are not called when the result is already cached). Therefore, most tests in this pull request have a locally created database extending MockDatabase and overriding the method(s) needed for the caching.

Also, the FireDatabase's sendMessage has been adapted to place the chat id into the database as well. Before, this was just an empty string in the database.

Luca-Engel commented 1 year ago

Thank you for the name catch. I have updated the name of the test as requested in the review and also merged the updated main into the branch.