use setInterval to wait for deploy complete

This commit is contained in:
Jonathan Rainville 2018-07-26 08:59:34 -04:00 committed by Iuri Matias
parent 40c363a310
commit d14630f636
1 changed files with 12 additions and 6 deletions

View File

@ -17,22 +17,28 @@ config({
"args": ["$ENSRegistry", rootNode], "args": ["$ENSRegistry", rootNode],
"onDeploy": [ "onDeploy": [
`ENSRegistry.methods.setOwner('${rootNode}', web3.eth.defaultAccount).send().then(() => { `ENSRegistry.methods.setOwner('${rootNode}', web3.eth.defaultAccount).send().then(() => {
ENSRegistry.methods.setResolver('${rootNode}', "$Resolver").send(); ENSRegistry.methods.setResolver('${rootNode}', "$Resolver").send();
Resolver.methods.setAddr('${rootNode}', '${address}').send(); Resolver.methods.setAddr('${rootNode}', '${address}').send().then(() => {
})` global.ensTestReady = true;
});
});`
] ]
} }
} }
}); });
contract("ENS", function () { contract("ENS", function () {
this.timeout(0); this.timeout(1000);
before(function (done) { before(function (done) {
// Wait for onDeploy to finish // Wait for onDeploy to finish
setTimeout(function () { const wait = setInterval(() => {
if (!global.ensTestReady) {
return;
}
clearInterval(wait);
done(); done();
}, 500); });
}); });
it("should have registered embark.eth", async function () { it("should have registered embark.eth", async function () {