Skip to content

Commit

Permalink
fix: ENS utils tests not being mocked correctly (#3218)
Browse files Browse the repository at this point in the history
  • Loading branch information
LautaroPetaccio authored Nov 6, 2024
1 parent 03051be commit 4d06a33
Showing 1 changed file with 2 additions and 7 deletions.
9 changes: 2 additions & 7 deletions src/modules/ens/utils.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,6 @@ import { extractEntityId } from 'lib/urn'
import { ENS } from './types'
import { addWorldStatusToEachENS, isExternalName } from './utils'

const MockWorldsAPI = WorldsAPI as jest.MockedClass<typeof WorldsAPI>
let worldsApi: WorldsAPI

describe('when checking if a subdomain is an external subdomain', () => {
let subdomain: string

Expand Down Expand Up @@ -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 () => {
Expand All @@ -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 () => {
Expand Down

0 comments on commit 4d06a33

Please sign in to comment.