Fix auto-formatting
This commit is contained in:
@ -1,45 +1,46 @@
|
|||||||
'use strict'
|
'use strict';
|
||||||
const assertJump = require('./helpers/assertJump')
|
const assertJump = require('./helpers/assertJump');
|
||||||
|
|
||||||
var Ownable = artifacts.require('../contracts/ownership/Ownable.sol')
|
var Ownable = artifacts.require('../contracts/ownership/Ownable.sol');
|
||||||
|
|
||||||
contract('Ownable', function(accounts) {
|
contract('Ownable', function(accounts) {
|
||||||
let ownable
|
let ownable;
|
||||||
|
|
||||||
beforeEach(async function() {
|
beforeEach(async function() {
|
||||||
ownable = await Ownable.new()
|
ownable = await Ownable.new();
|
||||||
})
|
});
|
||||||
|
|
||||||
it('should have an owner', async function() {
|
it('should have an owner', async function() {
|
||||||
let owner = await ownable.owner()
|
let owner = await ownable.owner();
|
||||||
assert.isTrue(owner !== 0)
|
assert.isTrue(owner !== 0);
|
||||||
})
|
});
|
||||||
|
|
||||||
it('changes owner after transfer', async function() {
|
it('changes owner after transfer', async function() {
|
||||||
let other = accounts[1]
|
let other = accounts[1];
|
||||||
await ownable.transferOwnership(other)
|
await ownable.transferOwnership(other);
|
||||||
let owner = await ownable.owner()
|
let owner = await ownable.owner();
|
||||||
|
|
||||||
assert.isTrue(owner === other)
|
assert.isTrue(owner === other);
|
||||||
})
|
});
|
||||||
|
|
||||||
it('should prevent non-owners from transfering', async function() {
|
it('should prevent non-owners from transfering', async function() {
|
||||||
const other = accounts[2]
|
const other = accounts[2];
|
||||||
const owner = await ownable.owner.call()
|
const owner = await ownable.owner.call();
|
||||||
assert.isTrue(owner !== other)
|
assert.isTrue(owner !== other);
|
||||||
try {
|
try {
|
||||||
await ownable.transferOwnership(other, {from: other})
|
await ownable.transferOwnership(other, {from: other});
|
||||||
} catch(error) {
|
} catch(error) {
|
||||||
assertJump(error)
|
assertJump(error);
|
||||||
}
|
}
|
||||||
})
|
});
|
||||||
|
|
||||||
it('should guard ownership against stuck state setting owner as 0x0 address', async function () {
|
it('should guard ownership against stuck state', async function() {
|
||||||
let originalOwner = await ownable.owner()
|
let originalOwner = await ownable.owner();
|
||||||
try {
|
try {
|
||||||
await ownable.transferOwnership(null, {from: originalOwner})
|
await ownable.transferOwnership(null, {from: originalOwner});
|
||||||
} catch(error) {
|
} catch(error) {
|
||||||
assertJump(error)
|
assertJump(error);
|
||||||
}
|
}
|
||||||
})
|
});
|
||||||
})
|
|
||||||
|
});
|
||||||
Reference in New Issue
Block a user