Take client creating functionality out of MatrixClientPeg (#34092)

* Take client creating functionality out of MatrixClientPeg

Because all sorts of things import MatrixClientPeg and this means
they pull in all manner of things related to creating a client, when
all they need is to get the current one (and specifically it fixes
the import cycle that means I can't add my test).

* Remove fake indexeddb

as it seems like the tests didn't actually see the fake indexeddb before
(somehow) but now do, and are failing because they have that but no postmessage.
It feels like the right solution is for these tests to not need indexeddb.

* Don't mock a refresh token

The tests don't mock out enough for the token refreshing setup to work,
it wa somehow always ending up as null previously and now wasn't, at which
point it broke, so just make it actually unset.

* Move formatter instatiation to lazy

rather than eagerly at parse time, as this apparently shifted one
test to hit this import cycle instead.

* Tests for room name generator
This commit is contained in:
David Baker
2026-07-03 15:21:59 +00:00
committed by GitHub
parent 0c0cb5df3d
commit ff8329be09
17 changed files with 359 additions and 191 deletions
@@ -32,7 +32,8 @@ import { LockSolidIcon } from "@vector-im/compound-design-tokens/assets/web/icon
import PosthogTrackers from "../../PosthogTrackers";
import { DecryptionFailureTracker } from "../../DecryptionFailureTracker";
import { type IMatrixClientCreds, MatrixClientPeg } from "../../MatrixClientPeg";
import { type IMatrixClientCreds } from "../../utils/createMatrixClient";
import { MatrixClientPeg } from "../../MatrixClientPeg";
import PlatformPeg from "../../PlatformPeg";
import SdkConfig, { type ConfigOptions } from "../../SdkConfig";
import dis from "../../dispatcher/dispatcher";