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 @@ -34,6 +34,7 @@ const ashoatDotEth = 'ashoat.eth'; const ashoatAddr = '0x911413ef4127910d79303483f7470d095f399ca9'; +const ashoatAvatar = 'https://ashoat.com/small_searching.png'; describe('getNameForAddress', () => { it('should fail to return ashoat.eth if not in cache', async () => { @@ -156,3 +157,31 @@ ); }); }); + +describe('getAvatarURIForAddress', () => { + it("should fail to return ashoat.eth's avatar if not in cache", async () => { + if (!process.env.ALCHEMY_API_KEY) { + return; + } + const ashoatAvatarResult = + ensCache.getCachedAvatarURIForAddress(ashoatAddr); + expect(ashoatAvatarResult).toBe(undefined); + }); + it("should return ashoat.eth's avatar", async () => { + if (!process.env.ALCHEMY_API_KEY) { + return; + } + const ashoatAvatarResult = await ensCache.getAvatarURIForAddress( + ashoatAddr, + ); + expect(ashoatAvatarResult).toBe(ashoatAvatar); + }); + it("should return ashoat.eth's avatar if in cache", async () => { + if (!process.env.ALCHEMY_API_KEY) { + return; + } + const ashoatAvatarResult = + ensCache.getCachedAvatarURIForAddress(ashoatAddr); + expect(ashoatAvatarResult).toBe(ashoatAvatar); + }); +});