Files
openzeppelin-contracts/test/ownership/Claimable.test.js
Nicolás Venturo ac91af9a6a Replace all asserts with chai.should (#1183)
* Moving towards chai.should.

* Fixed failing tests.

* Fixed linter errors.

* Revert package-lock.json changes.

* Fixed failing tests.

* s/eq/equal

* Addressed review comment
2018-08-10 19:03:04 -03:00

50 lines
1.4 KiB
JavaScript

const { assertRevert } = require('../helpers/assertRevert');
const Claimable = artifacts.require('Claimable');
const BigNumber = web3.BigNumber;
require('chai')
.use(require('chai-bignumber')(BigNumber))
.should();
contract('Claimable', function ([_, owner, newOwner, anyone]) {
let claimable;
beforeEach(async function () {
claimable = await Claimable.new({ from: owner });
});
it('should have an owner', async function () {
const owner = await claimable.owner();
owner.should.not.eq(0);
});
it('changes pendingOwner after transfer', async function () {
await claimable.transferOwnership(newOwner, { from: owner });
const pendingOwner = await claimable.pendingOwner();
pendingOwner.should.eq(newOwner);
});
it('should prevent to claimOwnership from anyone', async function () {
await assertRevert(claimable.claimOwnership({ from: anyone }));
});
it('should prevent non-owners from transfering', async function () {
await assertRevert(claimable.transferOwnership(anyone, { from: anyone }));
});
describe('after initiating a transfer', function () {
beforeEach(async function () {
await claimable.transferOwnership(newOwner, { from: owner });
});
it('changes allow pending owner to claim ownership', async function () {
await claimable.claimOwnership({ from: newOwner });
(await claimable.owner()).should.eq(newOwner);
});
});
});