ModuleAPI: overwrite_login action was not stopping the existing client resulting in the action failing with rust-sdk (#12272)

* Fix overwrite login action not stopping client

* remove unneeded fixture for overwrite login test

* Fix playwrite bad import of app sources

* revert uneeded change on fore OnLoggedIn causing side effects

* Add unit test for overwrite login action

* remove un needed ts-ignore
This commit is contained in:
Valere 2024-02-22 16:41:21 +01:00 committed by GitHub
parent b9bdd18666
commit 8a70260c81
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
4 changed files with 146 additions and 5 deletions

View file

@ -160,6 +160,12 @@ export class ProxiedModuleApi implements ModuleApi {
* @override
*/
public async overwriteAccountAuth(accountInfo: AccountAuthInfo): Promise<void> {
// We want to wait for the new login to complete before returning.
// See `Action.OnLoggedIn` in dispatcher.
const awaitNewLogin = new Promise<void>((resolve) => {
this.overrideLoginResolve = resolve;
});
dispatcher.dispatch<OverwriteLoginPayload>(
{
action: Action.OverwriteLogin,
@ -172,9 +178,7 @@ export class ProxiedModuleApi implements ModuleApi {
); // require to be sync to match inherited interface behaviour
// wait for login to complete
await new Promise<void>((resolve) => {
this.overrideLoginResolve = resolve;
});
await awaitNewLogin;
}
/**