so long story short I'm developing RESTapi that takes a movie title on POST request to the /movies route, fetches info about that movie from external api and saves that object to the database. On POST /comments you add a comment to the different collection but every comment has a 'movie_id' property that has an associated movie.
That's my first bigger project so I'm trying to write integrational tests. Everything is great, at least in my opinion, except 3 weird test cases that are failing just out of nowhere. Tests could pass 10 times in a row and then suddenly that weird 'jest' timer shows up and 3 cases fail.
I'm using native mongodb driver, express and jest with supertest for testing, dropping test-database BeforeAll and AfterEach, I have no idea whats the reason of that.
And after timer this shows up, failed tests:

Full source code is here GITHUB
Any ideas, tips?



Full source code is hereYou should post the relevant code in your question rather than expect helpers to try to search through your application...