From 512eeb5cf0c5eb9f37a03901f729b1f6877d88e4 Mon Sep 17 00:00:00 2001 From: gregfromstl Date: Tue, 12 Nov 2024 20:57:25 +0000 Subject: [PATCH] fix: unstoppable domains test (#5389) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ## Problem solved Short description of the bug fixed or feature added --- ## PR-Codex overview This PR modifies the test suite for resolving addresses with `Unstoppable Domain`. It updates the test structure to conditionally run based on the presence of `TW_SECRET_KEY` and retains the existing test logic. ### Detailed summary - Changed `describe` to conditionally run with `describe.runIf(process.env.TW_SECRET_KEY)`. - Retained the test for resolving a valid address. - Retained the test for handling a non-existent domain name. > ✨ Ask PR-Codex anything about this PR by commenting with `/codex {your question}` --- .../read/resolveAddress.test.ts | 47 ++++++++++--------- 1 file changed, 25 insertions(+), 22 deletions(-) diff --git a/packages/thirdweb/src/extensions/unstoppable-domains/read/resolveAddress.test.ts b/packages/thirdweb/src/extensions/unstoppable-domains/read/resolveAddress.test.ts index f85962fd906..4aa9eb7166b 100644 --- a/packages/thirdweb/src/extensions/unstoppable-domains/read/resolveAddress.test.ts +++ b/packages/thirdweb/src/extensions/unstoppable-domains/read/resolveAddress.test.ts @@ -4,26 +4,29 @@ import { resolveAddress } from "./resolveAddress.js"; // Double check: https://unstoppabledomains.com/d/thirdwebsdk.unstoppable -describe("Unstoppable Domain: resolve address", () => { - it("should resolve address", async () => { - expect( - ( - await resolveAddress({ - name: "thirdwebsdk.unstoppable", - client: TEST_CLIENT, - }) - ).toLowerCase(), - ).toBe("0x12345674b599ce99958242b3D3741e7b01841DF3".toLowerCase()); - }); +describe.runIf(process.env.TW_SECRET_KEY)( + "Unstoppable Domain: resolve address", + () => { + it("should resolve address", async () => { + expect( + ( + await resolveAddress({ + name: "thirdwebsdk.unstoppable", + client: TEST_CLIENT, + }) + ).toLowerCase(), + ).toBe("0x12345674b599ce99958242b3D3741e7b01841DF3".toLowerCase()); + }); - it("should throw an error with a non-existent domain name", async () => { - await expect(() => - resolveAddress({ - name: "thirdwebsdk.thissuredoesnotexist", - client: TEST_CLIENT, - }), - ).rejects.toThrowError( - "Could not resolve a valid tokenId from the domain: thirdwebsdk.thissuredoesnotexist. Make sure it exists.", - ); - }); -}); + it("should throw an error with a non-existent domain name", async () => { + await expect(() => + resolveAddress({ + name: "thirdwebsdk.thissuredoesnotexist", + client: TEST_CLIENT, + }), + ).rejects.toThrowError( + "Could not resolve a valid tokenId from the domain: thirdwebsdk.thissuredoesnotexist. Make sure it exists.", + ); + }); + }, +);