Skip to content
This repository was archived by the owner on Jul 6, 2022. It is now read-only.

Commit 372b257

Browse files
author
Victor Wiebe
committed
feat: 🎸 add setupCost to moduleFactory with associated test
1 parent 76b178f commit 372b257

File tree

2 files changed

+36
-7
lines changed

2 files changed

+36
-7
lines changed

‎src/contract_wrappers/modules/__tests__/module_factory_wrapper.test.ts‎

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -145,6 +145,27 @@ describe('ModuleFactoryWrapper', () => {
145145
});
146146
});
147147

148+
describe('setupCost', () => {
149+
test('should get setupCost', async () => {
150+
// Address expected
151+
const expectedResult = new BigNumber(100);
152+
// Mocked method
153+
const mockedMethod = mock(MockedSendMethod);
154+
// Stub the method
155+
when(mockedContract.setupCost).thenReturn(instance(mockedMethod));
156+
// Stub the request
157+
when(mockedMethod.callAsync()).thenResolve(expectedResult);
158+
159+
// Real call
160+
const result = await target.setupCost();
161+
// Result expectation
162+
expect(result).toEqual(weiToValue(expectedResult, FULL_DECIMALS));
163+
// Verifications
164+
verify(mockedContract.setupCost).once();
165+
verify(mockedMethod.callAsync()).once();
166+
});
167+
});
168+
148169
describe('setupCostInPoly', () => {
149170
test('should get setupCostInPoly', async () => {
150171
// Address expected

‎src/contract_wrappers/modules/module_factory_wrapper.ts‎

Lines changed: 15 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -120,13 +120,21 @@ export default class ModuleFactoryWrapper extends ContractWrapper {
120120
return (await this.contract).version.callAsync();
121121
};
122122

123-
/**
124-
* Get setup cost
125-
*/
126-
public setupCostInPoly = async (): Promise<BigNumber> => {
127-
const value = await (await this.contract).setupCostInPoly.callAsync();
128-
return weiToValue(value, FULL_DECIMALS);
129-
};
123+
/**
124+
* Get setup cost
125+
*/
126+
public setupCost = async (): Promise<BigNumber> => {
127+
const value = await (await this.contract).setupCost.callAsync();
128+
return weiToValue(value, FULL_DECIMALS);
129+
};
130+
131+
/**
132+
* Get setup cost in poly
133+
*/
134+
public setupCostInPoly = async (): Promise<BigNumber> => {
135+
const value = await (await this.contract).setupCostInPoly.callAsync();
136+
return weiToValue(value, FULL_DECIMALS);
137+
};
130138

131139
/**
132140
* Subscribe to an event type emitted by the contract.

0 commit comments

Comments
 (0)