From 4d06a33ed800458cb3e2cd8cb9e29eaae231e686 Mon Sep 17 00:00:00 2001 From: Lautaro Petaccio <1120791+LautaroPetaccio@users.noreply.github.com> Date: Wed, 6 Nov 2024 10:24:19 -0300 Subject: [PATCH] fix: ENS utils tests not being mocked correctly (#3218) --- src/modules/ens/utils.spec.ts | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/src/modules/ens/utils.spec.ts b/src/modules/ens/utils.spec.ts index 571bcf351..10b4ead63 100644 --- a/src/modules/ens/utils.spec.ts +++ b/src/modules/ens/utils.spec.ts @@ -3,9 +3,6 @@ import { extractEntityId } from 'lib/urn' import { ENS } from './types' import { addWorldStatusToEachENS, isExternalName } from './utils' -const MockWorldsAPI = WorldsAPI as jest.MockedClass -let worldsApi: WorldsAPI - describe('when checking if a subdomain is an external subdomain', () => { let subdomain: string @@ -52,15 +49,13 @@ describe('when adding the world status to each ens', () => { subdomain: 'name.dcl.eth' } ] as ENS[] - - worldsApi = new MockWorldsAPI() }) describe('when the fetch world request returns null', () => { beforeEach(() => { response = null - jest.spyOn(worldsApi, 'fetchWorld').mockResolvedValue(response) + jest.spyOn(WorldsAPI.prototype, 'fetchWorld').mockResolvedValue(response) }) it('should return the enss with the world status set to null', async () => { @@ -79,7 +74,7 @@ describe('when adding the world status to each ens', () => { } } as WorldInfo - global.fetch = () => Promise.resolve({ ok: true, json: () => Promise.resolve(response) } as Response) + jest.spyOn(WorldsAPI.prototype, 'fetchWorld').mockResolvedValue(response) }) it('should return the enss with the world status set', async () => {