Make test cases that use assertJump fail if they dont fail

pull/136/head
Jorge Izquierdo 8 years ago
parent ad833fb40d
commit 2f0471fff2
  1. 3
      test/BasicToken.js
  2. 6
      test/LimitBalance.js
  3. 9
      test/SafeMath.js
  4. 6
      test/StandardToken.js

@ -25,8 +25,9 @@ contract('BasicToken', function(accounts) {
try {
let transfer = await token.transfer(accounts[1], 101);
} catch(error) {
assertJump(error);
return assertJump(error);
}
assert.fail('should have thrown before');
});
});

@ -26,8 +26,9 @@ contract('LimitBalance', function(accounts) {
try {
let limDeposit = await lb.limitedDeposit({value: amount});
} catch(error) {
assertJump(error);
return assertJump(error);
}
assert.fail('should have thrown before');
});
it("should allow multiple sends below limit", async function() {
@ -49,8 +50,9 @@ contract('LimitBalance', function(accounts) {
try {
await lb.limitedDeposit({value: amount+1})
} catch(error) {
assertJump(error);
return assertJump(error);
}
assert.fail('should have thrown before');
});
});

@ -40,8 +40,9 @@ contract('SafeMath', function(accounts) {
try {
let subtract = await safeMath.subtract(a, b);
} catch(error) {
assertJump(error);
return assertJump(error);
}
assert.fail('should have thrown before');
});
it("should throw an error on addition overflow", async function() {
@ -50,8 +51,9 @@ contract('SafeMath', function(accounts) {
try {
let add = await safeMath.add(a, b);
} catch(error) {
assertJump(error);
return assertJump(error);
}
assert.fail('should have thrown before');
});
it("should throw an error on multiplication overflow", async function() {
@ -60,8 +62,9 @@ contract('SafeMath', function(accounts) {
try {
let multiply = await safeMath.multiply(a, b);
} catch(error) {
assertJump(error);
return assertJump(error);
}
assert.fail('should have thrown before');
});
});

@ -32,8 +32,9 @@ contract('StandardToken', function(accounts) {
try {
let transfer = await token.transfer(accounts[1], 101);
} catch(error) {
assertJump(error);
return assertJump(error);
}
assert.fail('should have thrown before');
});
it("should return correct balances after transfering from another account", async function() {
@ -57,8 +58,9 @@ contract('StandardToken', function(accounts) {
try {
let transfer = await token.transferFrom(accounts[0], accounts[2], 100, {from: accounts[1]});
} catch (error) {
assertJump(error);
return assertJump(error);
}
assert.fail('should have thrown before');
});
});

Loading…
Cancel
Save