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

Commit 3355cc4

Browse files
author
Victor Wiebe
committed
fix: refactor partition to an enum
across project, partition arguments and return types should have enum. undefined partition added in case a partition is returned and it is not partition unlocked. isValidPartition added to assertions. tokenupdatenameeventargs added in as for some reason werent included
1 parent bc13241 commit 3355cc4

File tree

4 files changed

+112
-83
lines changed

4 files changed

+112
-83
lines changed

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

Lines changed: 19 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,15 @@ import {
2020
ModuleRegistryContract,
2121
} from '@polymathnetwork/abi-wrappers';
2222
import ERC20TokenWrapper from '../erc20_wrapper';
23-
import { ModuleType, ModuleName, Feature, FundRaiseType, PERCENTAGE_DECIMALS, FULL_DECIMALS } from '../../../types';
23+
import {
24+
ModuleType,
25+
ModuleName,
26+
Feature,
27+
FundRaiseType,
28+
PERCENTAGE_DECIMALS,
29+
FULL_DECIMALS,
30+
Partition,
31+
} from '../../../types';
2432
import SecurityTokenWrapper from '../security_token_wrapper';
2533
import ContractFactory from '../../../factories/contractFactory';
2634
import {
@@ -105,7 +113,7 @@ describe('SecurityTokenWrapper', () => {
105113
test('should call to isOperatorForPartition', async () => {
106114
const expectedResult = true;
107115
const mockedParams = {
108-
partition: 'UNLOCKED',
116+
partition: Partition.Unlocked,
109117
operator: '0x5555555555555555555555555555555555555555',
110118
tokenHolder: '0x4444444444444444444444444444444444444444',
111119
};
@@ -323,7 +331,6 @@ describe('SecurityTokenWrapper', () => {
323331
});
324332
});
325333

326-
327334
describe('isOwner', () => {
328335
test('should call to isOwner', async () => {
329336
const expectedResult = true;
@@ -778,7 +785,7 @@ describe('SecurityTokenWrapper', () => {
778785
const expectedResult = new BigNumber(1);
779786
const mockedParams = {
780787
tokenHolder: '0x1111111111111111111111111111111111111111',
781-
partition: 'UNLOCKED',
788+
partition: Partition.Unlocked,
782789
};
783790

784791
const expectedDecimalsResult = new BigNumber(18);
@@ -1032,7 +1039,7 @@ describe('SecurityTokenWrapper', () => {
10321039
test('should call to canTransferByPartition', async () => {
10331040
const expectedStatusCode = 'X';
10341041
const expectedReasonCode = 'Reason';
1035-
const expectedPartition = 'Partition';
1042+
const expectedPartition = Partition.Unlocked;
10361043
const expectedResult = [
10371044
expectedStatusCode,
10381045
stringToBytes32(expectedReasonCode),
@@ -2175,7 +2182,7 @@ describe('SecurityTokenWrapper', () => {
21752182
test('should send the transaction to transferByPartition', async () => {
21762183
// Mocked parameters
21772184
const mockedParams = {
2178-
partition: 'UNLOCKED',
2185+
partition: Partition.Unlocked,
21792186
to: '0x2222222222222222222222222222222222222222',
21802187
value: new BigNumber(1),
21812188
data: 'string',
@@ -2298,7 +2305,7 @@ describe('SecurityTokenWrapper', () => {
22982305
test('should send the transaction to authorizeOperatorByPartition', async () => {
22992306
// Mocked parameters
23002307
const mockedParams = {
2301-
partition: 'UNLOCKED',
2308+
partition: Partition.Unlocked,
23022309
operator: '0x2222222222222222222222222222222222222222',
23032310
txData: {},
23042311
safetyFactor: 10,
@@ -2341,7 +2348,7 @@ describe('SecurityTokenWrapper', () => {
23412348
test('should send the transaction to revokeOperatorByPartition', async () => {
23422349
// Mocked parameters
23432350
const mockedParams = {
2344-
partition: 'UNLOCKED',
2351+
partition: Partition.Unlocked,
23452352
operator: '0x2222222222222222222222222222222222222222',
23462353
txData: {},
23472354
safetyFactor: 10,
@@ -2386,7 +2393,7 @@ describe('SecurityTokenWrapper', () => {
23862393
test('should send the transaction to transferByPartition', async () => {
23872394
// Mocked parameters
23882395
const mockedParams = {
2389-
partition: 'UNLOCKED',
2396+
partition: Partition.Unlocked,
23902397
from: '0x2222222222222222222222222222222222222222',
23912398
to: '0x2222222222222222222222222222222222222222',
23922399
value: new BigNumber(1),
@@ -2582,7 +2589,7 @@ describe('SecurityTokenWrapper', () => {
25822589
test('should send the transaction to issue', async () => {
25832590
// Mocked parameters
25842591
const mockedParams = {
2585-
partition: 'UNLOCKED',
2592+
partition: Partition.Unlocked,
25862593
investor: '0x1111111111111111111111111111111111111111',
25872594
value: new BigNumber(2),
25882595
data: 'string',
@@ -2807,7 +2814,7 @@ describe('SecurityTokenWrapper', () => {
28072814
test('should send the transaction to redeem', async () => {
28082815
// Mocked parameters
28092816
const mockedParams = {
2810-
partition: 'UNLOCKED',
2817+
partition: Partition.Unlocked,
28112818
value: new BigNumber(1),
28122819
data: 'string',
28132820
txData: {},
@@ -2879,7 +2886,7 @@ describe('SecurityTokenWrapper', () => {
28792886
test('should send the transaction to operatorRedeemByPartition', async () => {
28802887
// Mocked parameters
28812888
const mockedParams = {
2882-
partition: 'UNLOCKED',
2889+
partition: Partition.Unlocked,
28832890
tokenHolder: '0x9999999999999999999999999999999999999999',
28842891
value: new BigNumber(1),
28852892
data: 'string',

0 commit comments

Comments
 (0)