You've already forked matrix-js-sdk
mirror of
https://github.com/matrix-org/matrix-js-sdk.git
synced 2025-11-26 17:03:12 +03:00
There is a common pattern in the tests which is, when we want to mock a /sync, to flush it, and then, in the next tick of the promise loop, to wait for the syncing event. However, this is racy: there is no guarantee that the syncing event will not happen before the next tick of the promise loop. Instead, we should set the expectation of the syncing event, then do the flush. (Technically we only need to wait for the syncing event, but by waiting for both we'll catch any errors thrown by the flush, and make sure we don't have any outstanding flushes before proceeding). Add a utility method to TestClient to do the above, and use it where we have a TestClient. (Also fixes a couple of other minor buglets in the tests).
6.0 KiB
6.0 KiB