1
0
mirror of https://github.com/matrix-org/matrix-js-sdk.git synced 2025-11-25 05:23:13 +03:00

Make tests wait for syncs to happen

Add lots of calls to `syncPromise` to cope with the fact that sync responses
are now handled asynchronously, which makes them prone to races otherwise.

Also a quick sanity-check in crypto to make one of the test failures less
cryptic.
This commit is contained in:
Richard van der Hoff
2017-08-08 10:58:19 +01:00
parent 8563dd5860
commit ab8d06bb86
7 changed files with 81 additions and 49 deletions

View File

@@ -77,7 +77,10 @@ TestClient.prototype.start = function() {
pendingEventOrdering: 'detached',
});
return this.httpBackend.flushAllExpected().then(() => {
return Promise.all([
this.httpBackend.flushAllExpected(),
testUtils.syncPromise(this.client),
]).then(() => {
console.log(this + ': started');
});
};
@@ -199,5 +202,7 @@ TestClient.prototype.flushSync = function() {
return Promise.all([
this.httpBackend.flush('/sync', 1),
testUtils.syncPromise(this.client),
]);
]).then(() => {
console.log(`${this}: flushSync completed`);
});
};