tests: updated tests to ens_normalize test vectors
This commit is contained in:
parent
b9a2ab84d8
commit
433aba6f49
@ -16,9 +16,9 @@ import type { TestCaseNamehash, TestCaseSolidityHash } from "./types.js";
|
||||
|
||||
describe("Tests Namehash", function() {
|
||||
const tests = loadTests<TestCaseNamehash>("namehash");
|
||||
|
||||
for (const test of tests) {
|
||||
if (test.error) {
|
||||
} else {
|
||||
if (!test.error) {
|
||||
it(`hashes ENS name: ${ JSON.stringify(test.name) }`, function() {
|
||||
const actual = namehash(test.ensName);
|
||||
|
||||
@ -31,6 +31,25 @@ describe("Tests Namehash", function() {
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
for (const test of tests) {
|
||||
if (test.error) {
|
||||
it(`correctly fails to hash ENS name: ${ test.error } ${ JSON.stringify(test.name) }`, function() {
|
||||
assert.throws(function() {
|
||||
const actual = namehash(test.ensName);
|
||||
console.log("Failed to throw", actual);
|
||||
}, (error) => {
|
||||
return (isError(error, "INVALID_ARGUMENT") &&
|
||||
error.argument === "name" && error.value === test.ensName);
|
||||
})
|
||||
|
||||
// The empty string is not a valid ENS name
|
||||
if (test.ensName) {
|
||||
assert.ok(!isValidName(test.ensName), "!isValidName");
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
/*
|
||||
|
Binary file not shown.
Loading…
Reference in New Issue
Block a user