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

Commit 64b9a81

Browse files
author
Victor Wiebe
committed
feat: add isOwner to the wrappers for convenience
1 parent 97823b8 commit 64b9a81

File tree

2 files changed

+25
-0
lines changed

2 files changed

+25
-0
lines changed

src/contract_wrappers/tokens/__tests__/security_token_wrapper.test.ts

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -322,6 +322,27 @@ describe('SecurityTokenWrapper', () => {
322322
});
323323
});
324324

325+
326+
describe('isOwner', () => {
327+
test('should call to isOwner', async () => {
328+
const expectedResult = true;
329+
// Mocked method
330+
const mockedMethod = mock(MockedCallMethod);
331+
// Stub the method
332+
when(mockedContract.isOwner).thenReturn(instance(mockedMethod));
333+
// Stub the request
334+
when(mockedMethod.callAsync()).thenResolve(expectedResult);
335+
336+
// Real call
337+
const result = await target.isOwner();
338+
// Result expectation
339+
expect(result).toBe(expectedResult);
340+
// Verifications
341+
verify(mockedContract.isOwner).once();
342+
verify(mockedMethod.callAsync()).once();
343+
});
344+
});
345+
325346
describe('isControllable', () => {
326347
test('should call to isControllable', async () => {
327348
const expectedResult = true;

src/contract_wrappers/tokens/security_token_wrapper.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -956,6 +956,10 @@ export default class SecurityTokenWrapper extends ERC20TokenWrapper {
956956
return (await this.contract).isIssuable.callAsync();
957957
};
958958

959+
public isOwner = async (): Promise<boolean> => {
960+
return (await this.contract).isOwner.callAsync();
961+
};
962+
959963
public isControllable = async () => {
960964
return (await this.contract).isControllable.callAsync();
961965
};

0 commit comments

Comments
 (0)