Skip to content

Commit

Permalink
GovernChecker test cases updated to check reverts
Browse files Browse the repository at this point in the history
  • Loading branch information
maxsam4 committed Aug 23, 2018
1 parent 20ec1c0 commit 1a324c8
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions test/06_GovernChecker.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
const GovernCheckerContract = artifacts.require('GovernCheckerContract');
const catchRevert = require('../helpers/exceptions.js').catchRevert;
let gc;

contract('GovernCheckerContract', function([first, second]) {
contract('GovernCheckerContract', function([first, second, third]) {
before(function() {
GovernCheckerContract.deployed().then(function(instance) {
gc = instance;
Expand All @@ -11,11 +12,12 @@ contract('GovernCheckerContract', function([first, second]) {
it('should initalize authorized', async function() {
this.timeout(100000);
await gc.initializeAuthorized('0x41', first);
await catchRevert(gc.initializeAuthorized('0x41', second));
let authorizedAddressNumber = await gc.authorizedAddressNumber(
'0x41',
first
);
assert.isAtLeast(
assert.equal(
authorizedAddressNumber.toNumber(),
1,
'authorized not initialized properly'
Expand All @@ -24,13 +26,15 @@ contract('GovernCheckerContract', function([first, second]) {

it('should add authorized', async function() {
this.timeout(100000);
await catchRevert(gc.addAuthorized('0x41', second, { from: second }));
await gc.addAuthorized('0x41', second);
let authAddress = await gc.authorized('0x41', 1);
assert.equal(authAddress, second, 'authorized not added properly');
});

it('should update authorized', async function() {
this.timeout(100000);
await catchRevert(gc.updateAuthorized('0x41', gc.address, { from: third }));
await gc.updateAuthorized('0x41', gc.address);
let authorizedAddressNumber = await gc.authorizedAddressNumber(
'0x41',
Expand All @@ -46,10 +50,12 @@ contract('GovernCheckerContract', function([first, second]) {
it('should add gbm', async function() {
this.timeout(100000);
await gc.updateGBMAdress(first);
await catchRevert(gc.initializeAuthorized('0x42', first));
assert.equal(
await gc.GetGovBlockMasterAddress(),
first,
'gbm not added properly'
);
await catchRevert(gc.updateGBMAdress(second, { from: second }));
});
});

0 comments on commit 1a324c8

Please sign in to comment.