I have some tests cases which are testing mongoose Models. But on running them with Jest (typescript code) I get many running errors :
error TS2531: Object is possibly 'null'.
Example code (error is on line 3) :
const user = await User.findById("id_test");
expect(user).toBeDefined();
expect(user.password).not.toBe("older_password");
Yes my user can be null, but it can be a unprecise test case but certainly not a blocking error...
How can I make my test pass ? (Weither precising my test, weither silencing this type of error BUT I don't want to silence this error for the whole project, I want to silence only on tests file, not on src files).