Page Menu
Home
Phabricator
Search
Configure Global Search
Log In
Files
F2859025
D6427.id21495.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
3 KB
Referenced Files
None
Subscribers
None
D6427.id21495.diff
View Options
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);
});
});
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Wed, Oct 2, 12:20 PM (20 h, 36 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
2217599
Default Alt Text
D6427.id21495.diff (3 KB)
Attached To
Mode
D6427: [lib] Factor out constants in ENSCache tests
Attached
Detach File
Event Timeline
Log In to Comment