Skip to content

Commit

Permalink
test: add DNS records test
Browse files Browse the repository at this point in the history
  • Loading branch information
abdulla-cb committed Nov 27, 2024
1 parent ff94866 commit 64ad9e1
Showing 1 changed file with 28 additions and 0 deletions.
28 changes: 28 additions & 0 deletions test/UpgradeableL2Resolver/SetDNSRecords.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,34 @@ contract SetDNSRecords is UpgradeableL2ResolverBase {
assertEq(keccak256(soarecRet), keccak256(soarec));
}

function test_shouldKeepTrackOfEntries() public {
vm.startPrank(user);
resolver.setDNSRecords(node, dnsRecord);

// c.eth. 3600 IN A 1.2.3.4
bytes memory crec = hex"016303657468000001000100000e10000401020304";
resolver.setDNSRecords(node, crec);

(bytes memory cDnsName,) = NameEncoder.dnsEncodeName("c.eth");
(bytes memory dDnsName,) = NameEncoder.dnsEncodeName("d.eth");

// Initial check
assertTrue(resolver.hasDNSRecords(node, keccak256(cDnsName)));
assertFalse(resolver.hasDNSRecords(node, keccak256(dDnsName)));

// Update with no new data makes no difference
resolver.setDNSRecords(node, crec);
assertTrue(resolver.hasDNSRecords(node, keccak256(cDnsName)));

// c.eth. 3600 IN A
bytes memory crec2 = hex"016303657468000001000100000e100000";
resolver.setDNSRecords(node, crec2);

assertFalse(resolver.hasDNSRecords(node, keccak256("c.eth")));

vm.stopPrank();
}

function test_canClearRecord() public {
vm.startPrank(user);

Expand Down

0 comments on commit 64ad9e1

Please sign in to comment.