|
|
@ -1,4 +1,5 @@ |
|
|
|
'use strict'; |
|
|
|
'use strict'; |
|
|
|
|
|
|
|
const assertJump = require('./helpers/assertJump'); |
|
|
|
|
|
|
|
|
|
|
|
var DayLimitMock = artifacts.require('helpers/DayLimitMock.sol'); |
|
|
|
var DayLimitMock = artifacts.require('helpers/DayLimitMock.sol'); |
|
|
|
|
|
|
|
|
|
|
@ -32,9 +33,11 @@ contract('DayLimit', function(accounts) { |
|
|
|
let spentToday = await dayLimit.spentToday(); |
|
|
|
let spentToday = await dayLimit.spentToday(); |
|
|
|
assert.equal(spentToday, 8); |
|
|
|
assert.equal(spentToday, 8); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
try { |
|
|
|
await dayLimit.attemptSpend(3); |
|
|
|
await dayLimit.attemptSpend(3); |
|
|
|
spentToday = await dayLimit.spentToday(); |
|
|
|
} catch(error) { |
|
|
|
assert.equal(spentToday, 8); |
|
|
|
assertJump(error); |
|
|
|
|
|
|
|
} |
|
|
|
}); |
|
|
|
}); |
|
|
|
|
|
|
|
|
|
|
|
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() { |
|
|
@ -45,7 +48,11 @@ contract('DayLimit', function(accounts) { |
|
|
|
let spentToday = await dayLimit.spentToday(); |
|
|
|
let spentToday = await dayLimit.spentToday(); |
|
|
|
assert.equal(spentToday, 8); |
|
|
|
assert.equal(spentToday, 8); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
try { |
|
|
|
await dayLimit.attemptSpend(3); |
|
|
|
await dayLimit.attemptSpend(3); |
|
|
|
|
|
|
|
} catch(error) { |
|
|
|
|
|
|
|
assertJump(error); |
|
|
|
|
|
|
|
} |
|
|
|
spentToday = await dayLimit.spentToday(); |
|
|
|
spentToday = await dayLimit.spentToday(); |
|
|
|
assert.equal(spentToday, 8); |
|
|
|
assert.equal(spentToday, 8); |
|
|
|
|
|
|
|
|
|
|
@ -63,7 +70,11 @@ contract('DayLimit', function(accounts) { |
|
|
|
let spentToday = await dayLimit.spentToday(); |
|
|
|
let spentToday = await dayLimit.spentToday(); |
|
|
|
assert.equal(spentToday, 8); |
|
|
|
assert.equal(spentToday, 8); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
try { |
|
|
|
await dayLimit.attemptSpend(3); |
|
|
|
await dayLimit.attemptSpend(3); |
|
|
|
|
|
|
|
} catch(error) { |
|
|
|
|
|
|
|
assertJump(error); |
|
|
|
|
|
|
|
} |
|
|
|
spentToday = await dayLimit.spentToday(); |
|
|
|
spentToday = await dayLimit.spentToday(); |
|
|
|
assert.equal(spentToday, 8); |
|
|
|
assert.equal(spentToday, 8); |
|
|
|
|
|
|
|
|
|
|
|