From a834199dac51bba6e90d307840ae21a00e10f421 Mon Sep 17 00:00:00 2001 From: Joaquim Verges Date: Thu, 16 Jan 2025 14:46:18 +1300 Subject: [PATCH] [SDK] test: Refactor smart wallet signature verification tests (#5962) --- .../thirdweb/src/auth/verify-signature.test.ts | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/packages/thirdweb/src/auth/verify-signature.test.ts b/packages/thirdweb/src/auth/verify-signature.test.ts index f71aeece021..ea6c7793ff3 100644 --- a/packages/thirdweb/src/auth/verify-signature.test.ts +++ b/packages/thirdweb/src/auth/verify-signature.test.ts @@ -1,10 +1,11 @@ import * as ox__Bytes from "ox/Bytes"; -import { describe, expect, it, test } from "vitest"; +import { beforeAll, describe, expect, it, test } from "vitest"; import { FORKED_ETHEREUM_CHAIN } from "../../test/src/chains.js"; import { TEST_CLIENT } from "../../test/src/test-clients.js"; import { TEST_ACCOUNT_A } from "../../test/src/test-wallets.js"; import { ethereum, mainnet } from "../chains/chain-definitions/ethereum.js"; import { sepolia } from "../chains/chain-definitions/sepolia.js"; +import type { Account } from "../wallets/interfaces/wallet.js"; import { smartWallet } from "../wallets/smart/smart-wallet.js"; import { verifyContractWalletSignature, @@ -64,7 +65,7 @@ describe("verifyEOASignature", () => { describe.runIf(process.env.TW_SECRET_KEY)( "verifyContractWalletSignature", - async () => { + () => { it("should verify a valid signature", async () => { expect( await verifySignature({ @@ -107,15 +108,19 @@ describe.runIf(process.env.TW_SECRET_KEY)( describe.runIf(process.env.TW_SECRET_KEY)( "verifyContractWalletSignature", - async () => { + () => { const message = "Hakuna matata"; const wallet = smartWallet({ chain: ethereum, gasless: true, }); - const smartAccount = await wallet.connect({ - client: TEST_CLIENT, - personalAccount: TEST_ACCOUNT_A, + let smartAccount: Account; + + beforeAll(async () => { + smartAccount = await wallet.connect({ + client: TEST_CLIENT, + personalAccount: TEST_ACCOUNT_A, + }); }); test("should verify a smart account signature", async () => {