@@ -97,6 +97,13 @@ describe('ERC20DividendCheckpointWrapper', () => {
97
97
when ( mockedSecurityTokenOwnerMethod . callAsync ( ) ) . thenResolve ( expectedOwnerResult ) ;
98
98
when ( mockedSecurityTokenContract . owner ) . thenReturn ( instance ( mockedSecurityTokenOwnerMethod ) ) ;
99
99
100
+ const expectedTotalSupplyResult = new BigNumber ( 1000 ) ;
101
+ const mockedSecurityTokenTotalSupplyMethod = mock ( MockedCallMethod ) ;
102
+ when ( mockedSecurityTokenTotalSupplyMethod . callAsync ( ) ) . thenResolve (
103
+ expectedTotalSupplyResult ,
104
+ ) ;
105
+ when ( mockedSecurityTokenContract . totalSupply ) . thenReturn ( instance ( mockedSecurityTokenTotalSupplyMethod ) ) ;
106
+
100
107
const expectedBalanceOfResult = new BigNumber ( 100 ) ;
101
108
const mockedBalanceOfAddressMethod = mock ( MockedCallMethod ) ;
102
109
when ( mockedERC20DetailedContract . balanceOf ) . thenReturn ( instance ( mockedBalanceOfAddressMethod ) ) ;
@@ -165,9 +172,9 @@ describe('ERC20DividendCheckpointWrapper', () => {
165
172
) . once ( ) ;
166
173
verify ( mockedSecurityTokenOwnerMethod . callAsync ( ) ) . once ( ) ;
167
174
verify ( mockedSecurityTokenContract . owner ) . once ( ) ;
168
- verify ( mockedContract . securityToken ) . once ( ) ;
169
- verify ( mockedGetSecurityTokenAddressMethod . callAsync ( ) ) . once ( ) ;
170
- verify ( mockedContractFactory . getSecurityTokenContract ( expectedSecurityTokenAddress ) ) . once ( ) ;
175
+ verify ( mockedContract . securityToken ) . twice ( ) ;
176
+ verify ( mockedGetSecurityTokenAddressMethod . callAsync ( ) ) . twice ( ) ;
177
+ verify ( mockedContractFactory . getSecurityTokenContract ( expectedSecurityTokenAddress ) ) . twice ( ) ;
171
178
verify ( mockedWrapper . getAvailableAddressesAsync ( ) ) . times ( 2 ) ;
172
179
verify ( mockedERC20DetailedContract . balanceOf ) . once ( ) ;
173
180
verify ( mockedBalanceOfAddressMethod . callAsync ( expectedOwnerResult ) ) . once ( ) ;
@@ -176,6 +183,8 @@ describe('ERC20DividendCheckpointWrapper', () => {
176
183
verify ( mockedContractFactory . getERC20DetailedContract ( token ) ) . twice ( ) ;
177
184
verify ( mockedERC20DetailedContract . decimals ) . once ( ) ;
178
185
verify ( mockedDecimalsMethod . callAsync ( ) ) . once ( ) ;
186
+ verify ( mockedSecurityTokenTotalSupplyMethod . callAsync ( ) ) . once ( ) ;
187
+ verify ( mockedSecurityTokenContract . totalSupply ) . once ( ) ;
179
188
} ) ;
180
189
} ) ;
181
190
@@ -199,6 +208,13 @@ describe('ERC20DividendCheckpointWrapper', () => {
199
208
when ( mockedSecurityTokenOwnerMethod . callAsync ( ) ) . thenResolve ( expectedOwnerResult ) ;
200
209
when ( mockedSecurityTokenContract . owner ) . thenReturn ( instance ( mockedSecurityTokenOwnerMethod ) ) ;
201
210
211
+ const expectedTotalSupplyResult = new BigNumber ( 1000 ) ;
212
+ const mockedSecurityTokenTotalSupplyMethod = mock ( MockedCallMethod ) ;
213
+ when ( mockedSecurityTokenTotalSupplyMethod . callAsync ( objectContaining ( new BigNumber ( checkpointId ) ) ) ) . thenResolve (
214
+ expectedTotalSupplyResult ,
215
+ ) ;
216
+ when ( mockedSecurityTokenContract . totalSupplyAt ) . thenReturn ( instance ( mockedSecurityTokenTotalSupplyMethod ) ) ;
217
+
202
218
const expectedBalanceOfResult = new BigNumber ( 100 ) ;
203
219
const mockedBalanceOfAddressMethod = mock ( MockedCallMethod ) ;
204
220
when ( mockedERC20DetailedContract . balanceOf ) . thenReturn ( instance ( mockedBalanceOfAddressMethod ) ) ;
@@ -292,6 +308,8 @@ describe('ERC20DividendCheckpointWrapper', () => {
292
308
verify ( mockedContractFactory . getERC20DetailedContract ( token ) ) . twice ( ) ;
293
309
verify ( mockedERC20DetailedContract . decimals ) . once ( ) ;
294
310
verify ( mockedDecimalsMethod . callAsync ( ) ) . once ( ) ;
311
+ verify ( mockedSecurityTokenTotalSupplyMethod . callAsync ( objectContaining ( new BigNumber ( checkpointId ) ) ) ) . once ( ) ;
312
+ verify ( mockedSecurityTokenContract . totalSupplyAt ) . once ( ) ;
295
313
} ) ;
296
314
} ) ;
297
315
@@ -329,8 +347,8 @@ describe('ERC20DividendCheckpointWrapper', () => {
329
347
when (
330
348
mockedSecurityTokenBalanceOfMethod . callAsync ( addr , objectContaining ( new BigNumber ( checkpointId ) ) ) ,
331
349
) . thenResolve ( expectedSecurityTokenBalanceOfResult ) ;
332
- when ( mockedSecurityTokenContract . balanceOfAt ) . thenReturn ( instance ( mockedSecurityTokenBalanceOfMethod ) ) ;
333
350
}
351
+ when ( mockedSecurityTokenContract . balanceOfAt ) . thenReturn ( instance ( mockedSecurityTokenBalanceOfMethod ) ) ;
334
352
excluded . map ( whenBalanceOf ) ;
335
353
336
354
const expectedBalanceOfResult = new BigNumber ( 100 ) ;
@@ -460,6 +478,24 @@ describe('ERC20DividendCheckpointWrapper', () => {
460
478
when ( mockedSecurityTokenOwnerMethod . callAsync ( ) ) . thenResolve ( expectedOwnerResult ) ;
461
479
when ( mockedSecurityTokenContract . owner ) . thenReturn ( instance ( mockedSecurityTokenOwnerMethod ) ) ;
462
480
481
+ const excluded = [ '0x9999999999999999999999999999999999999999' , '0x8888888888888888888888888888888888888888' ] ;
482
+ const expectedTotalSupplyResult = new BigNumber ( 1000 ) ;
483
+ const mockedSecurityTokenTotalSupplyMethod = mock ( MockedCallMethod ) ;
484
+ when ( mockedSecurityTokenTotalSupplyMethod . callAsync ( ) ) . thenResolve (
485
+ expectedTotalSupplyResult ,
486
+ ) ;
487
+ when ( mockedSecurityTokenContract . totalSupply ) . thenReturn ( instance ( mockedSecurityTokenTotalSupplyMethod ) ) ;
488
+
489
+ const expectedSecurityTokenBalanceOfResult = new BigNumber ( 10 ) ;
490
+ const mockedSecurityTokenBalanceOfMethod = mock ( MockedCallMethod ) ;
491
+ function whenBalanceOf ( addr : string ) {
492
+ when (
493
+ mockedSecurityTokenBalanceOfMethod . callAsync ( addr ) ,
494
+ ) . thenResolve ( expectedSecurityTokenBalanceOfResult ) ;
495
+ }
496
+ when ( mockedSecurityTokenContract . balanceOf ) . thenReturn ( instance ( mockedSecurityTokenBalanceOfMethod ) ) ;
497
+ excluded . map ( whenBalanceOf ) ;
498
+
463
499
const expectedBalanceOfResult = new BigNumber ( 100 ) ;
464
500
const mockedBalanceOfAddressMethod = mock ( MockedCallMethod ) ;
465
501
when ( mockedERC20DetailedContract . balanceOf ) . thenReturn ( instance ( mockedBalanceOfAddressMethod ) ) ;
@@ -532,9 +568,9 @@ describe('ERC20DividendCheckpointWrapper', () => {
532
568
) . once ( ) ;
533
569
verify ( mockedSecurityTokenOwnerMethod . callAsync ( ) ) . once ( ) ;
534
570
verify ( mockedSecurityTokenContract . owner ) . once ( ) ;
535
- verify ( mockedContract . securityToken ) . once ( ) ;
536
- verify ( mockedGetSecurityTokenAddressMethod . callAsync ( ) ) . once ( ) ;
537
- verify ( mockedContractFactory . getSecurityTokenContract ( expectedSecurityTokenAddress ) ) . once ( ) ;
571
+ verify ( mockedContract . securityToken ) . twice ( ) ;
572
+ verify ( mockedGetSecurityTokenAddressMethod . callAsync ( ) ) . twice ( ) ;
573
+ verify ( mockedContractFactory . getSecurityTokenContract ( expectedSecurityTokenAddress ) ) . twice ( ) ;
538
574
verify ( mockedWrapper . getAvailableAddressesAsync ( ) ) . times ( 2 ) ;
539
575
verify ( mockedERC20DetailedContract . balanceOf ) . once ( ) ;
540
576
verify ( mockedBalanceOfAddressMethod . callAsync ( expectedOwnerResult ) ) . once ( ) ;
@@ -543,6 +579,15 @@ describe('ERC20DividendCheckpointWrapper', () => {
543
579
verify ( mockedContractFactory . getERC20DetailedContract ( token ) ) . twice ( ) ;
544
580
verify ( mockedERC20DetailedContract . decimals ) . once ( ) ;
545
581
verify ( mockedDecimalsMethod . callAsync ( ) ) . once ( ) ;
582
+ verify ( mockedSecurityTokenTotalSupplyMethod . callAsync ( ) ) . once ( ) ;
583
+ verify ( mockedSecurityTokenContract . totalSupply ) . once ( ) ;
584
+ function verifyBalanceOf ( addr : string ) {
585
+ verify (
586
+ mockedSecurityTokenBalanceOfMethod . callAsync ( addr ) ,
587
+ ) . once ( ) ;
588
+ }
589
+ when ( mockedSecurityTokenContract . balanceOf ) . thenReturn ( instance ( mockedSecurityTokenBalanceOfMethod ) ) ;
590
+ excluded . map ( verifyBalanceOf ) ;
546
591
} ) ;
547
592
} ) ;
548
593
0 commit comments