1
1
// PolymathRegistryWrapper test
2
- import { mock , instance , reset , when , verify } from 'ts-mockito' ;
2
+ import { mock , instance , reset } from 'ts-mockito' ;
3
3
import { Web3Wrapper } from '@0x/web3-wrapper' ;
4
4
import { ERC20DetailedContract , SecurityTokenRegistryEvents } from '@polymathnetwork/abi-wrappers' ;
5
- import { BigNumber } from '@0x/utils' ;
6
5
import ERC20TokenWrapper from '../erc20_wrapper' ;
7
6
import ERC20DetailedTokenWrapper from '../erc20_detailed_wrapper' ;
8
- import { MockedCallMethod } from '../../../test_utils/mocked_methods' ;
9
7
10
8
describe ( 'ERC20DetailedTokenWrapper' , ( ) => {
11
9
// Declare ERC20DetailedTokenWrapper object
@@ -32,73 +30,6 @@ describe('ERC20DetailedTokenWrapper', () => {
32
30
} ) ;
33
31
} ) ;
34
32
35
- describe ( 'name' , ( ) => {
36
- test ( 'should call to name' , async ( ) => {
37
- const expectedResult = 'string' ;
38
- // Mocked method
39
- const mockedMethod = mock ( MockedCallMethod ) ;
40
- // Stub the method
41
- when ( mockedContract . name ) . thenReturn ( instance ( mockedMethod ) ) ;
42
- // Stub the request
43
- when ( mockedMethod . callAsync ( ) ) . thenResolve ( expectedResult ) ;
44
-
45
- // Real call
46
- const result = await target . name ( ) ;
47
- // Result expectation
48
- expect ( result ) . toBe ( expectedResult ) ;
49
- // Verifications
50
- verify ( mockedContract . name ) . once ( ) ;
51
- verify ( mockedMethod . callAsync ( ) ) . once ( ) ;
52
- } ) ;
53
- } ) ;
54
-
55
- describe ( 'symbol' , ( ) => {
56
- test ( 'should call to symbol' , async ( ) => {
57
- const expectedResult = 'string' ;
58
- // Mocked method
59
- const mockedMethod = mock ( MockedCallMethod ) ;
60
- // Stub the method
61
- when ( mockedContract . symbol ) . thenReturn ( instance ( mockedMethod ) ) ;
62
- // Stub the request
63
- when ( mockedMethod . callAsync ( ) ) . thenResolve ( expectedResult ) ;
64
-
65
- // Real call
66
- const result = await target . symbol ( ) ;
67
- // Result expectation
68
- expect ( result ) . toBe ( expectedResult ) ;
69
- // Verifications
70
- verify ( mockedContract . symbol ) . once ( ) ;
71
- verify ( mockedMethod . callAsync ( ) ) . once ( ) ;
72
- } ) ;
73
- } ) ;
74
-
75
- describe ( 'isValidContract' , ( ) => {
76
- test ( 'should call to isValidContract' , async ( ) => {
77
- const expectedBNResult = new BigNumber ( 1 ) ;
78
- const expectedStringResult = 'string' ;
79
-
80
- const mockedTotalSupplyMethod = mock ( MockedCallMethod ) ;
81
- when ( mockedContract . totalSupply ) . thenReturn ( instance ( mockedTotalSupplyMethod ) ) ;
82
- when ( mockedTotalSupplyMethod . callAsync ( ) ) . thenResolve ( expectedBNResult ) ;
83
-
84
- const mockedSymbolMethod = mock ( MockedCallMethod ) ;
85
- when ( mockedContract . symbol ) . thenReturn ( instance ( mockedSymbolMethod ) ) ;
86
- when ( mockedSymbolMethod . callAsync ( ) ) . thenResolve ( expectedStringResult ) ;
87
-
88
- const mockedNameMethod = mock ( MockedCallMethod ) ;
89
- when ( mockedContract . name ) . thenReturn ( instance ( mockedNameMethod ) ) ;
90
- when ( mockedSymbolMethod . callAsync ( ) ) . thenResolve ( expectedStringResult ) ;
91
-
92
- const expectedIsValidResult = true ;
93
- const result = await target . isValidContract ( ) ;
94
- expect ( result ) . toBe ( expectedIsValidResult ) ;
95
-
96
- verify ( mockedContract . totalSupply ) . once ( ) ;
97
- verify ( mockedContract . symbol ) . once ( ) ;
98
- verify ( mockedContract . name ) . once ( ) ;
99
- } ) ;
100
- } ) ;
101
-
102
33
describe ( 'SubscribeAsync' , ( ) => {
103
34
test ( 'should throw as eventName does not belong to SecurityTokenRegistryEvents' , async ( ) => {
104
35
// Mocked parameters
0 commit comments