embark-area-51/test_apps/test_app/test/ens_spec.js

43 lines
1.1 KiB
JavaScript
Raw Normal View History

2018-07-25 20:12:17 +00:00
/*global contract, config, it, assert, before*/
const Resolver = require('Embark/contracts/Resolver');
const namehash = require('eth-ens-namehash');
const address = '0x38ac14a9B6a7c8F9C46e4804074186c9F201D0A0';
const rootNode = namehash.hash('embark.eth');
config({
contracts: {
"ENSRegistry": {
"args": []
},
"Resolver": {
"args": ["$ENSRegistry"]
},
"FIFSRegistrar": {
"args": ["$ENSRegistry", rootNode],
"onDeploy": [
`ENSRegistry.methods.setOwner('${rootNode}', web3.eth.defaultAccount).send().then(() => {
2018-07-25 20:12:17 +00:00
ENSRegistry.methods.setResolver('${rootNode}', "$Resolver").send();
Resolver.methods.setAddr('${rootNode}', '${address}').send();
})`
2018-07-25 20:12:17 +00:00
]
}
}
});
contract("ENS", function () {
2018-07-25 20:12:17 +00:00
this.timeout(0);
2018-07-25 20:12:17 +00:00
before(function (done) {
// Wait for onDeploy to finish
2018-07-25 20:12:17 +00:00
setTimeout(function () {
2018-07-25 20:12:17 +00:00
done();
2018-07-25 20:12:17 +00:00
}, 500);
2018-07-25 20:12:17 +00:00
});
it("should have registered embark.eth", async function () {
const domainAddress = await Resolver.methods.addr(rootNode).call();
assert.strictEqual(domainAddress, address);
});
});