Solved the issue with the unit test that could fail because it relied on setTimeout