From 32c1dafcf12b026ce4a00c48b2896f47ebd93ba3 Mon Sep 17 00:00:00 2001 From: CW Date: Thu, 7 Nov 2024 10:44:00 -0800 Subject: [PATCH] adjust test to use hooks --- .../sync-after-onboarding.spec.js | 30 +++++++++++-------- 1 file changed, 17 insertions(+), 13 deletions(-) diff --git a/e2e/specs/notifications/account-syncing/sync-after-onboarding.spec.js b/e2e/specs/notifications/account-syncing/sync-after-onboarding.spec.js index 3be2697e1e3..3338c463c7f 100644 --- a/e2e/specs/notifications/account-syncing/sync-after-onboarding.spec.js +++ b/e2e/specs/notifications/account-syncing/sync-after-onboarding.spec.js @@ -18,17 +18,7 @@ import { mockNotificationServices } from '../utils/mocks'; import { SmokeNotifications } from '../../../tags'; describe(SmokeNotifications('Account syncing'), () => { - it('retrieves all previously synced accounts', async () => { - const decryptedAccountNames = await Promise.all( - accountsSyncMockResponse.map(async (response) => { - const decryptedAccountName = await SDK.Encryption.decryptString( - response.Data, - NOTIFICATIONS_TEAM_STORAGE_KEY, - ); - return JSON.parse(decryptedAccountName).n; - }), - ); - + beforeAll(async () => { const mockServer = await startMockServer({ mockUrl: 'https://user-storage.api.cx.metamask.io/api/v1/userstorage', }); @@ -47,6 +37,22 @@ describe(SmokeNotifications('Account syncing'), () => { newInstance: true, delete: true, }); + }); + + afterAll(async () => { + await stopMockServer(); + }); + + it('retrieves all previously synced accounts', async () => { + const decryptedAccountNames = await Promise.all( + accountsSyncMockResponse.map(async (response) => { + const decryptedAccountName = await SDK.Encryption.decryptString( + response.Data, + NOTIFICATIONS_TEAM_STORAGE_KEY, + ); + return JSON.parse(decryptedAccountName).n; + }), + ); await importWalletWithRecoveryPhrase( NOTIFICATIONS_TEAM_SEED_PHRASE, @@ -61,7 +67,5 @@ describe(SmokeNotifications('Account syncing'), () => { await AccountListView.getAccountElementByAccountName(accountName), ); } - - await stopMockServer(); }); });