ens-usernames/test/abstract/controlled.js
Ricardo Guilherme Schmidt 50db6df321
Updates 151 ENS Usernames to Embark 3.1 (#21)
* fix run error

* transfer to zero should decerease supply (burn action)

* dont increment address 0 balance

* fix warning

* Update bootstrap to Embark 3.1 (#10)

* update configs to .js

* update tests

* better test abstraction

* undo changes after test

* small fixes
2018-09-05 03:52:30 -03:00

31 lines
1.1 KiB
JavaScript

exports.Test = (Controlled) => {
describe("Controlled", async function() {
this.timeout(0);
var accounts;
before(function(done) {
web3.eth.getAccounts().then(function (res) {
accounts = res;
done();
});
});
it("should start with msg.sender as controller", async function() {
var controller = await Controlled.methods.controller().call();
assert(controller, accounts[0]);
});
it("should allow controller to set new controller", async function() {
await Controlled.methods.changeController(accounts[1]).send({from: accounts[0]});
var controller = await Controlled.methods.controller().call();
assert(controller, accounts[1]);
});
it("should set back to original controller", async function() {
await Controlled.methods.changeController(accounts[0]).send({from: accounts[1]});
var controller = await Controlled.methods.controller().call();
assert(controller, accounts[0]);
});
});
}