fix testing error throwing
This commit is contained in:
@ -27,8 +27,9 @@ contract('Claimable', function(accounts) {
|
|||||||
try {
|
try {
|
||||||
await claimable.claimOwnership({from: accounts[2]});
|
await claimable.claimOwnership({from: accounts[2]});
|
||||||
} catch(error) {
|
} catch(error) {
|
||||||
assertJump(error);
|
return assertJump(error);
|
||||||
}
|
}
|
||||||
|
assert.fail('should have thrown before');
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should prevent non-owners from transfering', async function() {
|
it('should prevent non-owners from transfering', async function() {
|
||||||
@ -38,8 +39,9 @@ contract('Claimable', function(accounts) {
|
|||||||
try {
|
try {
|
||||||
await claimable.transferOwnership(other, {from: other});
|
await claimable.transferOwnership(other, {from: other});
|
||||||
} catch(error) {
|
} catch(error) {
|
||||||
assertJump(error);
|
return assertJump(error);
|
||||||
}
|
}
|
||||||
|
assert.fail('should have thrown before');
|
||||||
});
|
});
|
||||||
|
|
||||||
describe('after initiating a transfer', function () {
|
describe('after initiating a transfer', function () {
|
||||||
|
|||||||
@ -37,8 +37,9 @@ contract('DayLimit', function(accounts) {
|
|||||||
try {
|
try {
|
||||||
await dayLimit.attemptSpend(3);
|
await dayLimit.attemptSpend(3);
|
||||||
} catch(error) {
|
} catch(error) {
|
||||||
assertJump(error);
|
return assertJump(error);
|
||||||
}
|
}
|
||||||
|
assert.fail('should have thrown before');
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should allow spending if daily limit is reached and then set higher', async function() {
|
it('should allow spending if daily limit is reached and then set higher', async function() {
|
||||||
@ -50,14 +51,15 @@ contract('DayLimit', function(accounts) {
|
|||||||
await dayLimit.attemptSpend(3);
|
await dayLimit.attemptSpend(3);
|
||||||
} catch(error) {
|
} catch(error) {
|
||||||
assertJump(error);
|
assertJump(error);
|
||||||
}
|
|
||||||
spentToday = await dayLimit.spentToday();
|
spentToday = await dayLimit.spentToday();
|
||||||
assert.equal(spentToday, 8);
|
assert.equal(spentToday, 8);
|
||||||
|
|
||||||
await dayLimit.setDailyLimit(15);
|
await dayLimit.setDailyLimit(15);
|
||||||
await dayLimit.attemptSpend(3);
|
await dayLimit.attemptSpend(3);
|
||||||
spentToday = await dayLimit.spentToday();
|
spentToday = await dayLimit.spentToday();
|
||||||
assert.equal(spentToday, 11);
|
return assert.equal(spentToday, 11);
|
||||||
|
}
|
||||||
|
assert.fail('should have thrown before');
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should allow spending if daily limit is reached and then amount spent is reset', async function() {
|
it('should allow spending if daily limit is reached and then amount spent is reset', async function() {
|
||||||
@ -69,14 +71,15 @@ contract('DayLimit', function(accounts) {
|
|||||||
await dayLimit.attemptSpend(3);
|
await dayLimit.attemptSpend(3);
|
||||||
} catch(error) {
|
} catch(error) {
|
||||||
assertJump(error);
|
assertJump(error);
|
||||||
}
|
|
||||||
spentToday = await dayLimit.spentToday();
|
spentToday = await dayLimit.spentToday();
|
||||||
assert.equal(spentToday, 8);
|
assert.equal(spentToday, 8);
|
||||||
|
|
||||||
await dayLimit.resetSpentToday(15);
|
await dayLimit.resetSpentToday(15);
|
||||||
await dayLimit.attemptSpend(3);
|
await dayLimit.attemptSpend(3);
|
||||||
spentToday = await dayLimit.spentToday();
|
spentToday = await dayLimit.spentToday();
|
||||||
assert.equal(spentToday, 3);
|
return assert.equal(spentToday, 3);
|
||||||
|
}
|
||||||
|
assert.fail('should have thrown before');
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should allow spending if daily limit is reached and then the next has come', async function() {
|
it('should allow spending if daily limit is reached and then the next has come', async function() {
|
||||||
@ -91,7 +94,6 @@ contract('DayLimit', function(accounts) {
|
|||||||
await dayLimit.attemptSpend(3);
|
await dayLimit.attemptSpend(3);
|
||||||
} catch(error) {
|
} catch(error) {
|
||||||
assertJump(error);
|
assertJump(error);
|
||||||
}
|
|
||||||
spentToday = await dayLimit.spentToday();
|
spentToday = await dayLimit.spentToday();
|
||||||
assert.equal(spentToday, 8);
|
assert.equal(spentToday, 8);
|
||||||
|
|
||||||
@ -99,7 +101,9 @@ contract('DayLimit', function(accounts) {
|
|||||||
|
|
||||||
await dayLimit.attemptSpend(3);
|
await dayLimit.attemptSpend(3);
|
||||||
spentToday = await dayLimit.spentToday();
|
spentToday = await dayLimit.spentToday();
|
||||||
assert.equal(spentToday, 3);
|
return assert.equal(spentToday, 3);
|
||||||
|
}
|
||||||
|
assert.fail('should have thrown before');
|
||||||
});
|
});
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|||||||
@ -30,8 +30,9 @@ contract('Ownable', function(accounts) {
|
|||||||
try {
|
try {
|
||||||
await ownable.transferOwnership(other, {from: other});
|
await ownable.transferOwnership(other, {from: other});
|
||||||
} catch(error) {
|
} catch(error) {
|
||||||
assertJump(error);
|
return assertJump(error);
|
||||||
}
|
}
|
||||||
|
assert.fail('should have thrown before');
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should guard ownership against stuck state', async function() {
|
it('should guard ownership against stuck state', async function() {
|
||||||
|
|||||||
@ -24,10 +24,11 @@ contract('Pausable', function(accounts) {
|
|||||||
try {
|
try {
|
||||||
await Pausable.normalProcess();
|
await Pausable.normalProcess();
|
||||||
} catch(error) {
|
} catch(error) {
|
||||||
assertJump(error);
|
|
||||||
}
|
|
||||||
let count1 = await Pausable.count();
|
let count1 = await Pausable.count();
|
||||||
assert.equal(count1, 0);
|
assert.equal(count1, 0);
|
||||||
|
return assertJump(error);
|
||||||
|
}
|
||||||
|
assert.fail('should have thrown before');
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
@ -36,11 +37,11 @@ contract('Pausable', function(accounts) {
|
|||||||
try {
|
try {
|
||||||
await Pausable.drasticMeasure();
|
await Pausable.drasticMeasure();
|
||||||
} catch(error) {
|
} catch(error) {
|
||||||
assertJump(error);
|
|
||||||
}
|
|
||||||
|
|
||||||
const drasticMeasureTaken = await Pausable.drasticMeasureTaken();
|
const drasticMeasureTaken = await Pausable.drasticMeasureTaken();
|
||||||
assert.isFalse(drasticMeasureTaken);
|
assert.isFalse(drasticMeasureTaken);
|
||||||
|
return assertJump(error);
|
||||||
|
}
|
||||||
|
assert.fail('should have thrown before');
|
||||||
});
|
});
|
||||||
|
|
||||||
it('can take a drastic measure in a pause', async function() {
|
it('can take a drastic measure in a pause', async function() {
|
||||||
|
|||||||
Reference in New Issue
Block a user