From 4039417e943da273566555d24cd8b4bcc24a9ae0 Mon Sep 17 00:00:00 2001 From: ffmcgee Date: Fri, 10 Jan 2025 19:40:51 +0100 Subject: [PATCH] refactor: code review improvements --- ...ession.spec.ts => wallet_createSession.spec.ts} | 0 ...t-session.spec.ts => wallet_getSession.spec.ts} | 0 ...-method.spec.ts => wallet_invokeMethod.spec.ts} | 0 .../{notify.spec.ts => wallet_notify.spec.ts} | 0 ...ession.spec.ts => wallet_revokeSession.spec.ts} | 14 +++++++++++++- 5 files changed, 13 insertions(+), 1 deletion(-) rename test/e2e/flask/multichain-api/{create-session.spec.ts => wallet_createSession.spec.ts} (100%) rename test/e2e/flask/multichain-api/{get-session.spec.ts => wallet_getSession.spec.ts} (100%) rename test/e2e/flask/multichain-api/{invoke-method.spec.ts => wallet_invokeMethod.spec.ts} (100%) rename test/e2e/flask/multichain-api/{notify.spec.ts => wallet_notify.spec.ts} (100%) rename test/e2e/flask/multichain-api/{revoke-session.spec.ts => wallet_revokeSession.spec.ts} (89%) diff --git a/test/e2e/flask/multichain-api/create-session.spec.ts b/test/e2e/flask/multichain-api/wallet_createSession.spec.ts similarity index 100% rename from test/e2e/flask/multichain-api/create-session.spec.ts rename to test/e2e/flask/multichain-api/wallet_createSession.spec.ts diff --git a/test/e2e/flask/multichain-api/get-session.spec.ts b/test/e2e/flask/multichain-api/wallet_getSession.spec.ts similarity index 100% rename from test/e2e/flask/multichain-api/get-session.spec.ts rename to test/e2e/flask/multichain-api/wallet_getSession.spec.ts diff --git a/test/e2e/flask/multichain-api/invoke-method.spec.ts b/test/e2e/flask/multichain-api/wallet_invokeMethod.spec.ts similarity index 100% rename from test/e2e/flask/multichain-api/invoke-method.spec.ts rename to test/e2e/flask/multichain-api/wallet_invokeMethod.spec.ts diff --git a/test/e2e/flask/multichain-api/notify.spec.ts b/test/e2e/flask/multichain-api/wallet_notify.spec.ts similarity index 100% rename from test/e2e/flask/multichain-api/notify.spec.ts rename to test/e2e/flask/multichain-api/wallet_notify.spec.ts diff --git a/test/e2e/flask/multichain-api/revoke-session.spec.ts b/test/e2e/flask/multichain-api/wallet_revokeSession.spec.ts similarity index 89% rename from test/e2e/flask/multichain-api/revoke-session.spec.ts rename to test/e2e/flask/multichain-api/wallet_revokeSession.spec.ts index 2e78ff7fac5e..77da15c6d386 100644 --- a/test/e2e/flask/multichain-api/revoke-session.spec.ts +++ b/test/e2e/flask/multichain-api/wallet_revokeSession.spec.ts @@ -19,7 +19,7 @@ import { describe('Initializing a session w/ several scopes and accounts, then calling `wallet_revokeSession`', function () { const GANACHE_SCOPES = ['eip155:1337', 'eip155:1338', 'eip155:1000']; const ACCOUNTS = [ACCOUNT_1, ACCOUNT_2]; - it('Should receive empty object if `wallet_getSession` is called afterwards', async function () { + it('Should return empty object from `wallet_getSession` call', async function () { await withFixtures( { title: this.test?.fullTitle(), @@ -45,6 +45,18 @@ describe('Initializing a session w/ several scopes and accounts, then calling `w await driver.delay(largeDelayMs); await driver.switchToWindowWithTitle(WINDOW_TITLES.MultichainTestDApp); + /** + * We verify that scopes are not empty before calling `wallet_revokeSession` + */ + const { sessionScopes } = await getSessionScopes(driver); + for (const scope of GANACHE_SCOPES) { + assert.notStrictEqual( + sessionScopes[scope], + undefined, + `scope ${scope} should not be empty.`, + ); + } + await driver.clickElement({ text: 'wallet_revokeSession', tag: 'span',