mirror of https://github.com/embarklabs/embark.git
fix web3 being reseted every test and fix ens failing on web3 reset
This commit is contained in:
parent
ce3f9bdf25
commit
985358b088
|
@ -77,6 +77,9 @@ class ENS {
|
|||
this.registerConsoleCommands();
|
||||
}
|
||||
|
||||
reset() {
|
||||
this.configured = false;
|
||||
}
|
||||
|
||||
registerConsoleCommands() {
|
||||
this.embark.registerConsoleCommand((cmd, _options) => {
|
||||
|
@ -106,6 +109,7 @@ class ENS {
|
|||
|
||||
registerEvents() {
|
||||
this.embark.registerActionForEvent("deploy:beforeAll", this.configureContractsAndRegister.bind(this));
|
||||
this.events.setCommandHandler('blockchain:reset', this.reset.bind(this));
|
||||
this.events.setCommandHandler("storage:ens:associate", this.associateStorageToEns.bind(this));
|
||||
}
|
||||
|
||||
|
|
|
@ -128,7 +128,8 @@ class Test {
|
|||
return callback(__("contracts config error: unknown deployment type %s", type));
|
||||
}
|
||||
|
||||
if (accounts || port !== this.simOptions.port || type !== this.simOptions.type || host !== this.simOptions.host) {
|
||||
if (accounts || (port && port !== this.simOptions.port) || (type && type !== this.simOptions.type) ||
|
||||
(host && host !== this.simOptions.host)) {
|
||||
resetServices = true;
|
||||
}
|
||||
|
||||
|
|
|
@ -16,7 +16,7 @@ contract("AnotherStorageWithInterface", function() {
|
|||
|
||||
it("sets an empty address because ERC20 is an interface", async function() {
|
||||
let result = await AnotherStorage.methods.simpleStorageAddress().call();
|
||||
assert.equal(result.toString(), '0x0000000000000000000000000000000000000000');
|
||||
assert.strictEqual(result.toString(), '0x0000000000000000000000000000000000000000');
|
||||
});
|
||||
});
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/*global describe, config, it*/
|
||||
/*global describe, config, it, web3*/
|
||||
const assert = require('assert');
|
||||
const Token = require('Embark/contracts/Token');
|
||||
const MyToken = require('Embark/contracts/MyToken');
|
||||
|
@ -85,4 +85,11 @@ describe("Token", function () {
|
|||
it("should not deploy if deployIf returns false", function() {
|
||||
assert.ok(!SomeContract.options.address);
|
||||
});
|
||||
|
||||
it("should set the ens attr to the address of embark.eth", async function() {
|
||||
let result = await Test.methods.ens().call();
|
||||
// Testing that it is an address as we don't really know the address
|
||||
assert.strictEqual(web3.utils.isAddress(result), true);
|
||||
assert.notStrictEqual(result, '0x0000000000000000000000000000000000000000');
|
||||
});
|
||||
});
|
||||
|
|
Loading…
Reference in New Issue