diff --git a/lib/utils/ens-cache.test.js b/lib/utils/ens-cache.test.js --- a/lib/utils/ens-cache.test.js +++ b/lib/utils/ens-cache.test.js @@ -32,43 +32,38 @@ ); } +const ashoatDotEth = 'ashoat.eth'; +const ashoatAddr = '0x911413ef4127910d79303483f7470d095f399ca9'; + describe('getNameForAddress', () => { it('should fail to return ashoat.eth if not in cache', async () => { if (!process.env.ALCHEMY_API_KEY) { return; } - const obviouslyAshoatEth = ensCache.getCachedNameForAddress( - '0x911413ef4127910d79303483f7470d095f399ca9', - ); - expect(obviouslyAshoatEth).toBe(undefined); + const ashoatEthResult = ensCache.getCachedNameForAddress(ashoatAddr); + expect(ashoatEthResult).toBe(undefined); }); it('should return ashoat.eth', async () => { if (!process.env.ALCHEMY_API_KEY) { return; } - const obviouslyAshoatEth = await ensCache.getNameForAddress( - '0x911413ef4127910d79303483f7470d095f399ca9', - ); - expect(obviouslyAshoatEth).toBe('ashoat.eth'); + const ashoatEthResult = await ensCache.getNameForAddress(ashoatAddr); + expect(ashoatEthResult).toBe(ashoatDotEth); }); it('should return ashoat.eth if in cache', async () => { if (!process.env.ALCHEMY_API_KEY) { return; } - const obviouslyAshoatEth = ensCache.getCachedNameForAddress( - '0x911413ef4127910d79303483f7470d095f399ca9', - ); - expect(obviouslyAshoatEth).toBe('ashoat.eth'); + const ashoatEthResult = ensCache.getCachedNameForAddress(ashoatAddr); + expect(ashoatEthResult).toBe(ashoatDotEth); }); it('should have ashoat.eth cached', async () => { if (!process.env.ALCHEMY_API_KEY) { return; } const timesLookupAddressCalledBefore = timesLookupAddressCalled; - const obviouslyAshoatEth = await ensCache.getNameForAddress( - '0x911413ef4127910d79303483f7470d095f399ca9', - ); - expect(obviouslyAshoatEth).toBe('ashoat.eth'); + const ashoatEthResult = await ensCache.getNameForAddress(ashoatAddr); + expect(ashoatEthResult).toBe(ashoatDotEth); expect(timesLookupAddressCalled).toBe(timesLookupAddressCalledBefore); }); }); @@ -78,30 +73,30 @@ if (!process.env.ALCHEMY_API_KEY) { return; } - const ashoatAddr = ensCache.getCachedAddressForName('ashoat.eth'); - expect(ashoatAddr).toBe(undefined); + const ashoatAddrResult = ensCache.getCachedAddressForName(ashoatDotEth); + expect(ashoatAddrResult).toBe(undefined); }); it("should return ashoat.eth's address", async () => { if (!process.env.ALCHEMY_API_KEY) { return; } - const ashoatAddr = await ensCache.getAddressForName('ashoat.eth'); - expect(ashoatAddr).toBe('0x911413ef4127910d79303483f7470d095f399ca9'); + const ashoatAddrResult = await ensCache.getAddressForName(ashoatDotEth); + expect(ashoatAddrResult).toBe(ashoatAddr); }); it("should return ashoat.eth's address if in cache", async () => { if (!process.env.ALCHEMY_API_KEY) { return; } - const ashoatAddr = ensCache.getCachedAddressForName('ashoat.eth'); - expect(ashoatAddr).toBe('0x911413ef4127910d79303483f7470d095f399ca9'); + const ashoatAddrResult = ensCache.getCachedAddressForName(ashoatDotEth); + expect(ashoatAddrResult).toBe(ashoatAddr); }); it("should have ashoat.eth's address cached", async () => { if (!process.env.ALCHEMY_API_KEY) { return; } const timesResolveNameCalledBefore = timesResolveNameCalled; - const ashoatAddr = await ensCache.getAddressForName('ashoat.eth'); - expect(ashoatAddr).toBe('0x911413ef4127910d79303483f7470d095f399ca9'); + const ashoatAddrResult = await ensCache.getAddressForName(ashoatDotEth); + expect(ashoatAddrResult).toBe(ashoatAddr); expect(timesResolveNameCalled).toBe(timesResolveNameCalledBefore); }); });