-
Notifications
You must be signed in to change notification settings - Fork 58
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
5 changed files
with
125 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -55,6 +55,12 @@ it('returns offchain data', async () => { | |
TTL: 0, | ||
data: '"ENS1 0x238A8F792dFA6033814B18618aD4100654aeef01"', | ||
}, | ||
{ | ||
name: 'example.com', | ||
type: 46, | ||
TTL: 0, | ||
data: 'TXT ALGORITHM 2', | ||
}, | ||
], | ||
}) | ||
|
||
|
@@ -82,6 +88,12 @@ it('returns offchain data with extra data as address', async () => { | |
TTL: 0, | ||
data: '"ENS1 0x238A8F792dFA6033814B18618aD4100654aeef01 0x8e8Db5CcEF88cca9d624701Db544989C996E3216"', | ||
}, | ||
{ | ||
name: 'example.com', | ||
type: 46, | ||
TTL: 0, | ||
data: 'TXT ALGORITHM 2', | ||
}, | ||
], | ||
}) | ||
|
||
|
@@ -109,6 +121,12 @@ it('returns offchain data with extra data as text', async () => { | |
TTL: 0, | ||
data: '"ENS1 0x238A8F792dFA6033814B18618aD4100654aeef01 hello world"', | ||
}, | ||
{ | ||
name: 'example.com', | ||
type: 46, | ||
TTL: 0, | ||
data: 'TXT ALGORITHM 2', | ||
}, | ||
], | ||
}) | ||
|
||
|
@@ -136,6 +154,12 @@ it('returns offchain data from ens name', async () => { | |
TTL: 0, | ||
data: '"ENS1 dnsname.ens.eth"', | ||
}, | ||
{ | ||
name: 'example.com', | ||
type: 46, | ||
TTL: 0, | ||
data: 'TXT ALGORITHM 2', | ||
}, | ||
], | ||
}) | ||
|
||
|
@@ -169,6 +193,12 @@ it('returns first offchain data from multiple', async () => { | |
TTL: 0, | ||
data: '"ENS1 0x8e8Db5CcEF88cca9d624701Db544989C996E3216"', | ||
}, | ||
{ | ||
name: 'example.com', | ||
type: 46, | ||
TTL: 0, | ||
data: 'TXT ALGORITHM 2', | ||
}, | ||
], | ||
}) | ||
|
||
|
@@ -208,6 +238,12 @@ it('returns first valid offchain data when multiple invalid', async () => { | |
TTL: 0, | ||
data: '"ENS1 0x238A8F792dFA6033814B18618aD4100654aeef01"', | ||
}, | ||
{ | ||
name: 'example.com', | ||
type: 46, | ||
TTL: 0, | ||
data: 'TXT ALGORITHM 2', | ||
}, | ||
], | ||
}) | ||
|
||
|
@@ -235,6 +271,12 @@ it('allows subname input', async () => { | |
TTL: 0, | ||
data: '"ENS1 0x238A8F792dFA6033814B18618aD4100654aeef01"', | ||
}, | ||
{ | ||
name: 'sub.example.com', | ||
type: 46, | ||
TTL: 0, | ||
data: 'TXT ALGORITHM 3', | ||
}, | ||
], | ||
}) | ||
|
||
|
@@ -365,6 +407,52 @@ describe('no TXT records', () => { | |
}) | ||
}) | ||
|
||
describe('wildcard expansion', () => { | ||
beforeEach(() => { | ||
createHandlerResponse(handler, { | ||
Status: 0, | ||
AD: true, | ||
Answer: [ | ||
{ | ||
name: 'example.com', | ||
type: 16, | ||
TTL: 0, | ||
data: '"ENS1 0x238A8F792dFA6033814B18618aD4100654aeef01"', | ||
}, | ||
{ | ||
name: 'example.com', | ||
type: 46, | ||
TTL: 0, | ||
data: 'TXT ALGORITHM 1', | ||
}, | ||
], | ||
}) | ||
}) | ||
|
||
it('strict: throws error', async () => { | ||
await expect( | ||
getDnsOffchainData(mainnetPublicClient, { | ||
name: 'example.com', | ||
endpoint: serverUrl, | ||
strict: true, | ||
}), | ||
).rejects.toThrowErrorMatchingInlineSnapshot(` | ||
[DnsDnssecWildcardExpansionError: DNSSEC wildcard expansion not supported | ||
Version: @ensdomains/[email protected]] | ||
`) | ||
}) | ||
it('not strict: returns null', async () => { | ||
await expect( | ||
getDnsOffchainData(mainnetPublicClient, { | ||
name: 'example.com', | ||
endpoint: serverUrl, | ||
strict: false, | ||
}), | ||
).resolves.toBeNull() | ||
}) | ||
}) | ||
|
||
describe('only invalid records', () => { | ||
beforeEach(() => { | ||
createHandlerResponse(handler, { | ||
|
@@ -383,6 +471,12 @@ describe('only invalid records', () => { | |
TTL: 0, | ||
data: '"ENS1 randomnonsense"', | ||
}, | ||
{ | ||
name: 'example.com', | ||
type: 46, | ||
TTL: 0, | ||
data: 'TXT ALGORITHM 2', | ||
}, | ||
], | ||
}) | ||
}) | ||
|
@@ -430,6 +524,12 @@ describe('no eligible invalid records', () => { | |
TTL: 0, | ||
data: '"random"', | ||
}, | ||
{ | ||
name: 'example.com', | ||
type: 46, | ||
TTL: 0, | ||
data: 'TXT ALGORITHM 2', | ||
}, | ||
], | ||
}) | ||
}) | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters