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

Commit 228d451

Browse files
author
Victor Wiebe
committed
feat: getAllLockups test and method
1 parent 9cfde5e commit 228d451

File tree

2 files changed

+30
-0
lines changed

2 files changed

+30
-0
lines changed

src/contract_wrappers/modules/transfer_manager/__tests__/lock_up_transfer_manager_wrapper.test.ts

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -421,6 +421,28 @@ describe('LockUpTransferManagerWrapper', () => {
421421
});
422422
});
423423

424+
describe('getAllLockups', () => {
425+
test('should call to getAllLockups', async () => {
426+
const expectedResult = stringArrayToBytes32Array(['Lock1', 'Lock2']);
427+
428+
// Mocked method
429+
const mockedMethod = mock(MockedCallMethod);
430+
// Stub the method
431+
when(mockedContract.getAllLockups).thenReturn(instance(mockedMethod));
432+
// Stub the request
433+
when(mockedMethod.callAsync()).thenResolve(expectedResult);
434+
435+
// Real call
436+
const result = await target.getAllLockups();
437+
// Result expectation
438+
expect(result).toEqual(bytes32ArrayToStringArray(expectedResult));
439+
440+
// Verifications
441+
verify(mockedContract.getAllLockups).once();
442+
verify(mockedMethod.callAsync()).once();
443+
});
444+
});
445+
424446
describe('verifyTransfer', () => {
425447
test('should verify Transfer', async () => {
426448
const statusCode = new BigNumber(2);

src/contract_wrappers/modules/transfer_manager/lock_up_transfer_manager_wrapper.ts

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ import {
3030
} from '../../../types';
3131
import {
3232
bigNumberToDate,
33+
bytes32ArrayToStringArray,
3334
bytes32ToString,
3435
parseTransferResult,
3536
stringToBytes32,
@@ -260,6 +261,13 @@ export default class LockUpTransferManagerWrapper extends ModuleWrapper {
260261
return (await this.contract).getListOfAddresses.callAsync(stringToBytes32(params.lockupName));
261262
};
262263

264+
/**
265+
* getAllLockups
266+
*/
267+
public getAllLockups = async (): Promise<string[]> => {
268+
return bytes32ArrayToStringArray(await (await this.contract).getAllLockups.callAsync());
269+
};
270+
263271
public verifyTransfer = async (params: VerifyTransferParams): Promise<VerifyTransfer> => {
264272
assert.isETHAddressHex('from', params.from);
265273
assert.isETHAddressHex('to', params.to);

0 commit comments

Comments
 (0)