fix: made all the tests consistent. now with done.
This commit is contained in:
@ -1,24 +1,27 @@
|
||||
contract('LimitBalance', function(accounts) {
|
||||
var lb;
|
||||
let lb;
|
||||
|
||||
beforeEach(async function() {
|
||||
beforeEach(async function(done) {
|
||||
lb = await LimitBalanceMock.new();
|
||||
done();
|
||||
});
|
||||
|
||||
let LIMIT = 1000;
|
||||
|
||||
it("should expose limit", async function() {
|
||||
it("should expose limit", async function(done) {
|
||||
let limit = await lb.limit();
|
||||
assert.equal(limit, LIMIT);
|
||||
done();
|
||||
});
|
||||
|
||||
it("should allow sending below limit", async function() {
|
||||
it("should allow sending below limit", async function(done) {
|
||||
let amount = 1;
|
||||
let limDeposit = await lb.limitedDeposit({value: amount});
|
||||
assert.equal(web3.eth.getBalance(lb.address), amount);
|
||||
done();
|
||||
});
|
||||
|
||||
it("shouldnt allow sending above limit", async function() {
|
||||
it("shouldnt allow sending above limit", async function(done) {
|
||||
|
||||
let amount = 1110;
|
||||
try {
|
||||
@ -26,29 +29,31 @@ contract('LimitBalance', function(accounts) {
|
||||
} catch(error) {
|
||||
if (error.message.search('invalid JUMP') == -1) throw error
|
||||
assert.isAbove(error.message.search('invalid JUMP'), -1, 'Invalid JUMP error must be returned');
|
||||
done();
|
||||
}
|
||||
});
|
||||
|
||||
it("should allow multiple sends below limit", async function() {
|
||||
it("should allow multiple sends below limit", async function(done) {
|
||||
let amount = 500;
|
||||
|
||||
let limDeposit = await lb.limitedDeposit({value: amount});
|
||||
assert.equal(web3.eth.getBalance(lb.address), amount);
|
||||
let limDeposit2 = await lb.limitedDeposit({value: amount});
|
||||
assert.equal(web3.eth.getBalance(lb.address), amount*2);
|
||||
done();
|
||||
});
|
||||
|
||||
it("shouldnt allow multiple sends above limit", async function() {
|
||||
it("shouldnt allow multiple sends above limit", async function(done) {
|
||||
let amount = 500;
|
||||
|
||||
|
||||
let limDeposit = await lb.limitedDeposit({value: amount});
|
||||
assert.equal(web3.eth.getBalance(lb.address), amount);
|
||||
try {
|
||||
lb.limitedDeposit({value: amount+1})
|
||||
await lb.limitedDeposit({value: amount+1})
|
||||
} catch(error) {
|
||||
if (error.message.search('invalid JUMP') == -1) throw error
|
||||
assert.isAbove(error.message.search('invalid JUMP'), -1, 'Invalid JUMP error must be returned');
|
||||
done();
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
Reference in New Issue
Block a user