From 0e2d64181304552369cbfc0b5bdcbf0cb6d646d9 Mon Sep 17 00:00:00 2001 From: legobeat <109787230+legobeat@users.noreply.github.com> Date: Wed, 17 May 2023 15:09:20 +0000 Subject: [PATCH] test: sanitize url hostname check (#19053) --- app/scripts/controllers/network/provider-api-tests/helpers.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/scripts/controllers/network/provider-api-tests/helpers.ts b/app/scripts/controllers/network/provider-api-tests/helpers.ts index edcc1ca02..104715d13 100644 --- a/app/scripts/controllers/network/provider-api-tests/helpers.ts +++ b/app/scripts/controllers/network/provider-api-tests/helpers.ts @@ -149,7 +149,7 @@ function mockRpcCall({ } } /* @ts-expect-error The types for Nock do not include `basePath` in the interface for Nock.Scope. */ - const url = nockScope.basePath.includes('infura.io') + const url = new URL(nockScope.basePath).hostname.match(/(\.|^)infura.io$/u) ? `/v3/${MOCK_INFURA_PROJECT_ID}` : '/';