Skip to content

Commit

Permalink
chore: add test coverage on protocol getter
Browse files Browse the repository at this point in the history
Coverage droppned while refactoring. As currently the value of 'MVP()' is not used.
We only check protocol != More_VP() now. This commit add test to bring up the coverage.
  • Loading branch information
boolafish committed Dec 5, 2019
1 parent 1a9be37 commit 7219494
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 1 deletion.
10 changes: 10 additions & 0 deletions plasma_framework/contracts/mocks/framework/ProtocolWrapper.sol
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,16 @@ pragma solidity 0.5.11;
import "../../src/framework/Protocol.sol";

contract ProtocolWrapper {
// solhint-disable-next-line func-name-mixedcase
function MVP() public pure returns (uint8) {
return Protocol.MVP();
}

// solhint-disable-next-line func-name-mixedcase
function MORE_VP() public pure returns (uint8) {
return Protocol.MORE_VP();
}

function isValidProtocol(uint8 protocol) public pure returns (bool) {
return Protocol.isValidProtocol(protocol);
}
Expand Down
15 changes: 14 additions & 1 deletion plasma_framework/test/src/framework/Protocol.test.js
Original file line number Diff line number Diff line change
@@ -1,14 +1,27 @@
const Protocol = artifacts.require('ProtocolWrapper');

const { BN } = require('openzeppelin-test-helpers');
const { expect } = require('chai');

const { PROTOCOL } = require('../../helpers/constants.js');

contract('Protocol', () => {
contract.only('Protocol', () => {
before(async () => {
this.test = await Protocol.new();
});

describe('MORE_VP()', () => {
it('should return protocol value of MoreVP', async () => {
expect(await this.test.MORE_VP()).to.be.bignumber.equal(new BN(PROTOCOL.MORE_VP));
});
});

describe('MVP()', () => {
it('should return protocol value of MVP', async () => {
expect(await this.test.MVP()).to.be.bignumber.equal(new BN(PROTOCOL.MVP));
});
});

describe('isValidProtocol', () => {
it('should return true for MVP protocol', async () => {
expect(await this.test.isValidProtocol(PROTOCOL.MVP)).to.be.true;
Expand Down

0 comments on commit 7219494

Please sign in to comment.