1
0
mirror of https://github.com/matrix-org/matrix-js-sdk.git synced 2025-12-04 05:02:41 +03:00

More test deflakifying (#491)

Call `flushAllExpected()` from some more places. In a couple of places, we were
apparently calling `flush()` redundantly, so remove it altogether.
This commit is contained in:
Richard van der Hoff
2017-07-12 14:05:39 +01:00
committed by Luke Barnard
parent b5a8e6bbdf
commit 83bd24adf8

View File

@@ -92,7 +92,7 @@ function startClient(httpBackend, client) {
});
return q.all([
httpBackend.flush(),
httpBackend.flushAllExpected(),
deferred.promise,
]);
}
@@ -138,16 +138,13 @@ describe("getEventTimeline support", function() {
timelineSupport: true,
});
return q.all([
startClient(httpBackend, client).then(function() {
return startClient(httpBackend, client).then(() => {
const room = client.getRoom(roomId);
const timelineSet = room.getTimelineSets()[0];
expect(function() {
client.getEventTimeline(timelineSet, "event");
}).toNotThrow();
}),
httpBackend.flush(),
]);
});
});
@@ -281,7 +278,7 @@ describe("MatrixClient event timelines", function() {
expect(tl.getPaginationToken(EventTimeline.FORWARDS))
.toEqual("end_token");
}),
httpBackend.flush(),
httpBackend.flushAllExpected(),
]);
});
@@ -304,8 +301,7 @@ describe("MatrixClient event timelines", function() {
},
});
return q.all([
httpBackend.flush("/sync").then(function() {
return httpBackend.flush("/sync").then(function() {
return client.getEventTimeline(timelineSet, EVENTS[0].event_id);
}).then(function(tl) {
expect(tl.getEvents().length).toEqual(2);
@@ -315,9 +311,7 @@ describe("MatrixClient event timelines", function() {
.toEqual("f_1_1");
// expect(tl.getPaginationToken(EventTimeline.FORWARDS))
// .toEqual("s_5_4");
}),
httpBackend.flush(),
]);
});
});
it("should update timelines where they overlap a previous /sync", function() {
@@ -369,7 +363,7 @@ describe("MatrixClient event timelines", function() {
});
return q.all([
httpBackend.flush(),
httpBackend.flushAllExpected(),
deferred.promise,
]);
});
@@ -466,7 +460,7 @@ describe("MatrixClient event timelines", function() {
expect(tl3.getPaginationToken(EventTimeline.FORWARDS))
.toEqual("end_token3");
}),
httpBackend.flush(),
httpBackend.flushAllExpected(),
]);
});
@@ -494,7 +488,7 @@ describe("MatrixClient event timelines", function() {
}, function(e) {
expect(String(e)).toMatch(/'event'/);
}),
httpBackend.flush(),
httpBackend.flushAllExpected(),
]);
});
});
@@ -547,7 +541,7 @@ describe("MatrixClient event timelines", function() {
expect(tl.getPaginationToken(EventTimeline.FORWARDS))
.toEqual("end_token0");
}),
httpBackend.flush(),
httpBackend.flushAllExpected(),
]);
});
@@ -600,7 +594,7 @@ describe("MatrixClient event timelines", function() {
expect(tl.getPaginationToken(EventTimeline.FORWARDS))
.toEqual("end_token1");
}),
httpBackend.flush(),
httpBackend.flushAllExpected(),
]);
});
});
@@ -732,7 +726,7 @@ describe("MatrixClient event timelines", function() {
};
httpBackend.when("GET", "/sync").respond(200, syncData);
httpBackend.flush().then(function() {
httpBackend.flushAllExpected().then(function() {
const room = client.getRoom(roomId);
const tl = room.getLiveTimeline();
expect(tl.getEvents().length).toEqual(3);
@@ -757,7 +751,7 @@ describe("MatrixClient event timelines", function() {
};
httpBackend.when("GET", "/sync").respond(200, sync2);
return httpBackend.flush();
return httpBackend.flushAllExpected();
}).then(function() {
const room = client.getRoom(roomId);
const tl = room.getLiveTimeline();