Skip to content

Commit

Permalink
Merge pull request #16 from FinBook/esplanade
Browse files Browse the repository at this point in the history
FIN-845 #comment add isContractPassed
  • Loading branch information
yizhoucao committed Jan 30, 2019
2 parents ab7ec91 + b9821a7 commit 0d7754c
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 0 deletions.
7 changes: 7 additions & 0 deletions src/EsplanadeWrapper.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,9 @@ const web3Wrapper = {
})),
getAddresses: jest.fn(() => ({
call: jest.fn()
})),
passedContract: jest.fn(() => ({
call: jest.fn(() => Promise.resolve(true))
}))
}
}))
Expand Down Expand Up @@ -282,3 +285,7 @@ test('getContractPoolSize', async () => {
test('voteStartTimestamp', async () => {
expect(await esplanadeWrapper.getVotingData()).toMatchSnapshot();
});

test('isContractPassed', async () => {
expect(await esplanadeWrapper.isContractPassed('address')).toMatchSnapshot();
});
4 changes: 4 additions & 0 deletions src/EsplanadeWrapper.ts
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,10 @@ export class EsplanadeWrapper extends BaseContractWrapper {
return isStarted.valueOf();
}

public isContractPassed(address: string): Promise<boolean> {
return this.contract.methods.passedContract(address).call();
}

public async getVotingData(): Promise<IVotingData> {
return {
started: (await this.contract.methods.voteStartTimestamp().call()) * 1000,
Expand Down
2 changes: 2 additions & 0 deletions src/__snapshots__/EsplanadeWrapper.test.ts.snap
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,8 @@ Object {
}
`;

exports[`isContractPassed 1`] = `true`;

exports[`removeAddress 1`] = `"Read Only Mode"`;

exports[`removeAddress 2`] = `
Expand Down

0 comments on commit 0d7754c

Please sign in to comment.