diff --git a/tests/sessionTime.spec.ts b/tests/sessionTime.spec.ts index 685fb2a..9231b4f 100644 --- a/tests/sessionTime.spec.ts +++ b/tests/sessionTime.spec.ts @@ -63,19 +63,20 @@ variable.forEach(async (testVariable) => { await test(`#Variable SessionTime test : ${JSON.stringify({ sessionTime: testVariable.sessionTime })} - disableSessionManager: ${disableSessionManager} client_id: ${web3AuthClientId}`, async (t) => { - const coreKitInstance = new Web3AuthMPCCoreKit({ - web3AuthClientId, - web3AuthNetwork, - baseUrl: "http://localhost:3000", - uxMode, - tssLib, - storage: storageInstance, - manualSync, - sessionTime, - disableSessionManager, - }); + let coreKitInstance: Web3AuthMPCCoreKit; async function beforeTest() { + coreKitInstance= new Web3AuthMPCCoreKit({ + web3AuthClientId, + web3AuthNetwork, + baseUrl: "http://localhost:3000", + uxMode, + tssLib, + storage: storageInstance, + manualSync, + sessionTime, + disableSessionManager, + }); if (coreKitInstance.status === COREKIT_STATUS.INITIALIZED) await criticalResetAccount(coreKitInstance); } @@ -110,7 +111,8 @@ variable.forEach(async (testVariable) => { return; } - coreKitInstance.signatures.forEach((sig) => { + const sigs = await coreKitInstance.getSessionSignatures(); + sigs.forEach((sig) => { const parsedSig = JSON.parse(sig); const parsedSigData = JSON.parse(atob(parsedSig.data)); diff --git a/tests/sfaImport.spec.ts b/tests/sfaImport.spec.ts index bfd2ec9..a2e934e 100644 --- a/tests/sfaImport.spec.ts +++ b/tests/sfaImport.spec.ts @@ -4,8 +4,8 @@ import test from "node:test"; import { tssLib as tssLibDKLS } from "@toruslabs/tss-dkls-lib"; import { tssLib as tssLibFROST } from "@toruslabs/tss-frost-lib"; -import { AsyncStorage, MemoryStorage, TssLibType, TssShareType, WEB3AUTH_NETWORK } from "../src"; -import { criticalResetAccount, generateRandomEmail, loginWithSFA, newCoreKitLogInInstance } from "./setup"; +import { MemoryStorage, TssLibType, TssShareType, WEB3AUTH_NETWORK } from "../src"; +import { generateRandomEmail, loginWithSFA, newCoreKitLogInInstance } from "./setup"; type ImportKeyTestVariable = { manualSync?: boolean; @@ -26,17 +26,9 @@ export const ImportSFATest = async (testVariable: ImportKeyTestVariable) => { }); } - async function resetAccount(email: string) { - const kit = await newCoreKitInstance(email); - await criticalResetAccount(kit); - await kit.logout(); - await new AsyncStorage(kit._storageKey, storageInstance).resetStore(); - } test(`import sfa key and recover tss key : ${testVariable.manualSync}`, async function (t) { - const afterTest = async () => { - await resetAccount(testVariable.email); - }; + await t.test("#recover Tss key using 2 factors key, import tss key to new oauth login", async function () { const sfaResult = await loginWithSFA({ network: WEB3AUTH_NETWORK.DEVNET, @@ -85,7 +77,6 @@ export const ImportSFATest = async (testVariable: ImportKeyTestVariable) => { }); - await afterTest(); t.afterEach(function () { return console.info("finished running recovery test"); });