fmg-simple-adjudicator
Advanced tools
Comparing version 0.0.6 to 0.0.8
{ | ||
"name": "fmg-simple-adjudicator", | ||
"version": "0.0.6", | ||
"version": "0.0.8", | ||
"description": "Simple adjudicator for force-move games", | ||
@@ -22,5 +22,5 @@ "directories": { | ||
"esm": "^3.0.52", | ||
"truffle-assertions": "^0.3.1", | ||
"truffle-assertions": "^0.4.0", | ||
"truffle-core": "^4.1.11" | ||
} | ||
} |
@@ -13,4 +13,4 @@ import { Channel, State, assertRevert, increaseTime, duration, CountingGame } from 'fmg-core'; | ||
const B_IDX = 2; | ||
const aBal = Number(web3.toWei(6, "ether")); | ||
const bBal = Number(web3.toWei(4, "ether")); | ||
const aBal = Number(web3.toWei('6', "ether")); | ||
const bBal = Number(web3.toWei('4', "ether")); | ||
const resolution = [aBal, bBal]; | ||
@@ -373,2 +373,41 @@ const differentResolution = [bBal, aBal]; | ||
}); | ||
describe('events', async () => { | ||
it('emits fundsReceived upon contract creation', async () => { | ||
CountingStateContract.link(StateLib); | ||
let stateContract = await CountingStateContract.new(); | ||
CountingGameContract.link('CountingState', stateContract.address); | ||
let countingGameContract = await CountingGameContract.new(); | ||
channel = new Channel(countingGameContract.address, 0, [accounts[A_IDX], accounts[B_IDX]]); | ||
simpleAdj = await SimpleAdjudicator.new(channel.id); | ||
let result = await truffleAssert.createTransactionResult(simpleAdj, simpleAdj.transactionHash); | ||
truffleAssert.eventEmitted(result, 'FundsReceived', (event) => { | ||
return ( | ||
event.adjudicatorBalance.toPrecision(1) === '0' | ||
); | ||
}); | ||
}); | ||
it('emits fundsReceived upon being sent funds', async () => { | ||
await simpleAdj.sendTransaction({ | ||
from: accounts[9], | ||
value: 50 | ||
}); | ||
let result = await simpleAdj.sendTransaction({ | ||
from: accounts[9], | ||
value: 100 | ||
}); | ||
truffleAssert.eventEmitted(result, 'FundsReceived', (event) => { | ||
return ( | ||
event.adjudicatorBalance.toPrecision(3) === '150' && | ||
event.sender === accounts[9] && | ||
event.amountReceived.toPrecision(3) === '100' | ||
); | ||
}); | ||
}) | ||
}); | ||
}); |
Sorry, the diff of this file is not supported yet
27239
357