diff --git a/test/PullPayment.js b/test/PullPayment.js index f8536d732..4e74170da 100644 --- a/test/PullPayment.js +++ b/test/PullPayment.js @@ -1,15 +1,19 @@ var PullPaymentMock = artifacts.require("./helpers/PullPaymentMock.sol"); contract('PullPayment', function(accounts) { - + let ppce; + let tAMOUNT = 17*1e18; + + beforeEach(async function() { + ppce = await PullPaymentMock.new({value: tAMOUNT}); + }); + it("can't call asyncSend externally", async function() { - let ppc = await PullPaymentMock.new(); - assert.isUndefined(ppc.asyncSend); + assert.isUndefined(ppce.asyncSend); }); it("can record an async payment correctly", async function() { let AMOUNT = 100; - let ppce = await PullPaymentMock.new(); let callSend = await ppce.callSend(accounts[0], AMOUNT); let paymentsToAccount0 = await ppce.payments(accounts[0]); let totalPayments = await ppce.totalPayments(); @@ -19,7 +23,6 @@ contract('PullPayment', function(accounts) { }); it("can add multiple balances on one account", async function() { - let ppce = await PullPaymentMock.new(); let call1 = await ppce.callSend(accounts[0], 200); let call2 = await ppce.callSend(accounts[0], 300); let paymentsToAccount0 = await ppce.payments(accounts[0]); @@ -30,7 +33,6 @@ contract('PullPayment', function(accounts) { }); it("can add balances on multiple accounts", async function() { - let ppce = await PullPaymentMock.new(); let call1 = await ppce.callSend(accounts[0], 200); let call2 = await ppce.callSend(accounts[1], 300); @@ -45,11 +47,9 @@ contract('PullPayment', function(accounts) { }); it("can withdraw payment", async function() { - let AMOUNT = 17*1e18; let payee = accounts[1]; let initialBalance = web3.eth.getBalance(payee); - let ppce = await PullPaymentMock.new({value: AMOUNT}); let call1 = await ppce.callSend(payee, AMOUNT); let payment1 = await ppce.payments(payee);