I have a test that contains many done functions. I assumed that in the case of a failed test, only this test would be displayed as faulty. Now I notice that not only one test is displayed as faulty, but all following tests that contain done are displayed as faulty.
Why is this the case? This makes it difficult to find out the faulty test later.
This is successful
describe('Map#isRotating', () => {
test('returns false by default', done => {
const map = createMap();
expect(map.isRotating()).toBe(false);
map.remove();
done();
});
test('returns true during a camera rotate animation', done => {
const map = createMap();
map.on('rotatestart', () => {
expect(map.isRotating()).toBe(true);
});
map.on('rotateend', () => {
expect(true).toBe(false);
map.remove();
done();
});
map.rotateTo(5, {duration: 0});
});
test('returns true when drag rotating', done => {
const map = createMap();
// Prevent inertial rotation.
jest.spyOn(browser, 'now').mockImplementation(() => { return 0; });
map.on('rotatestart', () => {
expect(map.isRotating()).toBe(true);
});
map.on('rotateend', () => {
expect(map.isRotating()).toBe(false);
map.remove();
done();
});
simulate.mousedown(map.getCanvas(), {buttons: 2, button: 2});
map._renderTaskQueue.run();
simulate.mousemove(map.getCanvas(), {buttons: 2, clientX: 10, clientY: 10});
map._renderTaskQueue.run();
simulate.mouseup(map.getCanvas(), {buttons: 0, button: 2});
map._renderTaskQueue.run();
});
});
All tests with done are fail if I change the first test
describe('Map#isRotating', () => {
test('returns false by default', done => {
const map = createMap();
expect(true).toBe(false);
map.remove();
done();
});