@@ -81,15 +81,15 @@ describe('ModifyShareholderData', () => {
81
81
{
82
82
address : testAddress ,
83
83
canSendAfter : new Date ( Date . now ( ) ) ,
84
- canReceiveAfter : new Date ( 0 , 0 ) ,
84
+ canReceiveAfter : new Date ( 1980 , 1 ) ,
85
85
kycExpiry : new Date ( 2035 , 1 ) ,
86
86
canBuyFromSto : true ,
87
87
isAccredited : true ,
88
88
} ,
89
89
{
90
90
address : testAddress2 ,
91
91
canSendAfter : new Date ( Date . now ( ) ) ,
92
- canReceiveAfter : new Date ( 0 , 0 ) ,
92
+ canReceiveAfter : new Date ( 1980 , 1 ) ,
93
93
kycExpiry : new Date ( 2035 , 1 ) ,
94
94
canBuyFromSto : true ,
95
95
isAccredited : true ,
@@ -144,25 +144,7 @@ describe('ModifyShareholderData', () => {
144
144
) . toEqual ( true ) ;
145
145
expect ( addTransactionSpy . callCount ) . toEqual ( 2 ) ;
146
146
} ) ;
147
- // TODO
148
- /*
149
- test('should throw if corresponding checkpoint event is not fired', async () => {
150
- ImportMock.mockFunction(utilsModule, 'findEvents', []);
151
-
152
- // Real call
153
- const resolver = await target.prepareTransactions();
154
147
155
- await expect(
156
- resolver.run({} as TransactionReceiptWithDecodedLogs)
157
- ).rejects.toThrow(
158
- new PolymathError({
159
- code: ErrorCode.UnexpectedEventLogs,
160
- message:
161
- "The Checkpoint was successfully created but the corresponding event wasn't fired. Please report this issue to the Polymath team.",
162
- })
163
- );
164
- });
165
- */
166
148
test ( 'should return the newly created checkpoint' , async ( ) => {
167
149
const shareholderObject = {
168
150
shareholder : {
@@ -180,7 +162,9 @@ describe('ModifyShareholderData', () => {
180
162
expect (
181
163
fetchStub . getCall ( 0 ) . calledWithExactly (
182
164
Shareholder . generateId ( {
183
- securityTokenId : SecurityToken . generateId ( { symbol : params . symbol } ) ,
165
+ securityTokenId : SecurityToken . generateId ( {
166
+ symbol : params . symbol ,
167
+ } ) ,
184
168
address : params . shareholderData [ 0 ] . address ,
185
169
} )
186
170
)
@@ -202,5 +186,46 @@ describe('ModifyShareholderData', () => {
202
186
} )
203
187
) ;
204
188
} ) ;
189
+ /*
190
+ test('should throw if there is an invalid epoch time', async () => {
191
+ const invalidParams = params;
192
+ invalidParams.shareholderData = [{
193
+ canReceiveAfter: new Date(1970,0),
194
+ canSendAfter: new Date(1970,0),
195
+ address: testAddress,
196
+ canBuyFromSto: true,
197
+ isAccredited: true,
198
+ kycExpiry: new Date(0, 0)
199
+ }];
200
+ target = new ModifyShareholderData(invalidParams, contextMock.getMockInstance());
201
+ await expect(target.prepareTransactions()).rejects.toThrow(
202
+ new PolymathError({
203
+ code: ErrorCode.ProcedureValidationError,
204
+ message:
205
+ "Cannot set dates to epoch. If you're trying to revoke a shareholder's KYC, use .revokeKyc()",
206
+ })
207
+ );
208
+ });
209
+
210
+ test('should throw if modifying share holder fails', async () => {
211
+ await expect(target.prepareTransactions()).rejects.toThrow(
212
+ new PolymathError({
213
+ code: ErrorCode.ProcedureValidationError,
214
+ message: 'Modify shareholder data failed: Nothing to modify',
215
+ })
216
+ );
217
+ });
218
+ */
219
+ test ( 'should throw if the general transfer manager is not enabled' , async ( ) => {
220
+ wrappersMock . mock ( 'getAttachedModules' , { } ) ;
221
+ await expect ( target . prepareTransactions ( ) ) . rejects . toThrow (
222
+ new PolymathError ( {
223
+ code : ErrorCode . ProcedureValidationError ,
224
+ message : `General Transfer Manager for token "${
225
+ params . symbol
226
+ } " isn't enabled. Please report this issue to the Polymath team`,
227
+ } )
228
+ ) ;
229
+ } ) ;
205
230
} ) ;
206
231
} ) ;
0 commit comments