Skip to content

Commit

Permalink
test: refactor tests for events
Browse files Browse the repository at this point in the history
  • Loading branch information
pgebal committed Aug 19, 2020
1 parent 2fef884 commit 6dc88a2
Show file tree
Hide file tree
Showing 6 changed files with 358 additions and 31 deletions.
257 changes: 257 additions & 0 deletions plasma_framework/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 2 additions & 1 deletion plasma_framework/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,11 @@
"solidoc": "^1.0.5"
},
"devDependencies": {
"elliptic": ">=6.5.3",
"@codechecks/client": "^0.1.10",
"@openzeppelin/test-helpers": "^0.5.6",
"chai": "^4.2.0",
"coveralls": "^3.0.6",
"elliptic": ">=6.5.3",
"eslint": "^5.3.0",
"eslint-config-airbnb-base": "^13.1.0",
"eslint-plugin-import": "^2.17.3",
Expand Down
18 changes: 14 additions & 4 deletions plasma_framework/test/endToEndTests/FeeClaim.e2e.test.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
const EthVault = artifacts.require('EthVault');
const PaymentExitGame = artifacts.require('PaymentExitGame');
const PlasmaFramework = artifacts.require('PlasmaFramework');
const PaymentStartStandardExit = artifacts.require('PaymentStartStandardExit');
const PaymentStartInFlightExit = artifacts.require('PaymentStartInFlightExit');

const { constants, expectEvent } = require('openzeppelin-test-helpers');

Expand Down Expand Up @@ -227,12 +229,16 @@ contract('PlasmaFramework - Fee Claim', ([_, _maintainer, authority, richFather,
};

const bondSize = await this.paymentExitGame.startStandardExitBondSize();
const tx = await this.paymentExitGame.startStandardExit(args, {
const { receipt } = await this.paymentExitGame.startStandardExit(args, {
from: operatorFeeAddress,
value: bondSize.add(this.processExitBountySize),
gasPrice: this.dummyGasPrice,
});
await expectEvent.inLogs(tx.logs, 'ExitStarted', { owner: operatorFeeAddress });
await expectEvent.inTransaction(
receipt.transactionHash,
PaymentStartStandardExit,
'ExitStarted',
);
});

it('should be able to in-flight exit the fee via Payment transaction', async () => {
Expand All @@ -247,11 +253,15 @@ contract('PlasmaFramework - Fee Claim', ([_, _maintainer, authority, richFather,
};

const bondSize = await this.paymentExitGame.startIFEBondSize();
const tx = await this.paymentExitGame.startInFlightExit(args, {
const { receipt } = await this.paymentExitGame.startInFlightExit(args, {
from: alice,
value: bondSize,
});
await expectEvent.inLogs(tx.logs, 'InFlightExitStarted');
await expectEvent.inTransaction(
receipt.transactionHash,
PaymentStartInFlightExit,
'InFlightExitStarted',
);
});
});
});
Expand Down
Loading

0 comments on commit 6dc88a2

Please sign in to comment.