diff --git a/src/services/ens/index.test.ts b/src/services/ens/index.test.ts index ff2a617d79..72b99f3d9c 100644 --- a/src/services/ens/index.test.ts +++ b/src/services/ens/index.test.ts @@ -6,6 +6,7 @@ import { logError } from '../exceptions' const rpcProvider = { resolveName: jest.fn(() => Promise.resolve('0x0000000000000000000000000000000000000000')), lookupAddress: jest.fn(() => Promise.resolve('safe.eth')), + getNetwork: jest.fn(() => Promise.resolve({ chainId: 1 })), } as unknown as JsonRpcProvider const badRpcProvider = { @@ -19,6 +20,10 @@ jest.mock('../exceptions', () => ({ logError: jest.fn(), })) +jest.mock('./custom', () => ({ + customResolveName: jest.fn(() => Promise.resolve('0x0000001111111111111111111111111111111111')), +})) + describe('domains', () => { describe('isDomain', () => { it('should check the domain format', async () => { @@ -40,6 +45,15 @@ describe('domains', () => { expect(address).toBe(undefined) expect(logError).toHaveBeenCalledWith('101: Failed to resolve the address', 'bad resolveName') }) + + it('should look up names on Sepolia', async () => { + // mock rpcProvider + const rpcProvider = { + getNetwork: jest.fn(() => Promise.resolve({ chainId: 11155111 })), + } as unknown as JsonRpcProvider + + expect(await resolveName(rpcProvider, 'sepolia.eth')).toBe('0x0000001111111111111111111111111111111111') + }) }) describe('lookupAddress', () => {