1
1
const { BN , constants, expectEvent, expectRevert } = require ( 'openzeppelin-test-helpers' ) ;
2
2
const { ZERO_ADDRESS } = constants ;
3
3
4
+ const { expect } = require ( 'chai' ) ;
5
+
4
6
const {
5
7
shouldBehaveLikeERC20,
6
8
shouldBehaveLikeERC20Transfer,
@@ -51,12 +53,12 @@ contract('ERC20', function ([_, initialHolder, recipient, anotherAccount]) {
51
53
it ( 'decreases the spender allowance subtracting the requested amount' , async function ( ) {
52
54
await this . token . decreaseAllowance ( spender , approvedAmount . subn ( 1 ) , { from : initialHolder } ) ;
53
55
54
- ( await this . token . allowance ( initialHolder , spender ) ) . should . be . bignumber . equal ( '1' ) ;
56
+ expect ( await this . token . allowance ( initialHolder , spender ) ) . to . be . bignumber . equal ( '1' ) ;
55
57
} ) ;
56
58
57
59
it ( 'sets the allowance to zero when all allowance is removed' , async function ( ) {
58
60
await this . token . decreaseAllowance ( spender , approvedAmount , { from : initialHolder } ) ;
59
- ( await this . token . allowance ( initialHolder , spender ) ) . should . be . bignumber . equal ( '0 ' ) ;
61
+ expect ( await this . token . allowance ( initialHolder , spender ) ) . to . be . bignumber . equal ( '1 ' ) ;
60
62
} ) ;
61
63
62
64
it ( 'reverts when more than the full allowance is removed' , async function ( ) {
@@ -114,7 +116,7 @@ contract('ERC20', function ([_, initialHolder, recipient, anotherAccount]) {
114
116
it ( 'approves the requested amount' , async function ( ) {
115
117
await this . token . increaseAllowance ( spender , amount , { from : initialHolder } ) ;
116
118
117
- ( await this . token . allowance ( initialHolder , spender ) ) . should . be . bignumber . equal ( amount ) ;
119
+ expect ( await this . token . allowance ( initialHolder , spender ) ) . to . be . bignumber . equal ( amount ) ;
118
120
} ) ;
119
121
} ) ;
120
122
@@ -126,7 +128,7 @@ contract('ERC20', function ([_, initialHolder, recipient, anotherAccount]) {
126
128
it ( 'increases the spender allowance adding the requested amount' , async function ( ) {
127
129
await this . token . increaseAllowance ( spender , amount , { from : initialHolder } ) ;
128
130
129
- ( await this . token . allowance ( initialHolder , spender ) ) . should . be . bignumber . equal ( amount . addn ( 1 ) ) ;
131
+ expect ( await this . token . allowance ( initialHolder , spender ) ) . to . be . bignumber . equal ( amount . addn ( 1 ) ) ;
130
132
} ) ;
131
133
} ) ;
132
134
} ) ;
@@ -148,7 +150,7 @@ contract('ERC20', function ([_, initialHolder, recipient, anotherAccount]) {
148
150
it ( 'approves the requested amount' , async function ( ) {
149
151
await this . token . increaseAllowance ( spender , amount , { from : initialHolder } ) ;
150
152
151
- ( await this . token . allowance ( initialHolder , spender ) ) . should . be . bignumber . equal ( amount ) ;
153
+ expect ( await this . token . allowance ( initialHolder , spender ) ) . to . be . bignumber . equal ( amount ) ;
152
154
} ) ;
153
155
} ) ;
154
156
@@ -160,7 +162,7 @@ contract('ERC20', function ([_, initialHolder, recipient, anotherAccount]) {
160
162
it ( 'increases the spender allowance adding the requested amount' , async function ( ) {
161
163
await this . token . increaseAllowance ( spender , amount , { from : initialHolder } ) ;
162
164
163
- ( await this . token . allowance ( initialHolder , spender ) ) . should . be . bignumber . equal ( amount . addn ( 1 ) ) ;
165
+ expect ( await this . token . allowance ( initialHolder , spender ) ) . to . be . bignumber . equal ( amount . addn ( 1 ) ) ;
164
166
} ) ;
165
167
} ) ;
166
168
} ) ;
@@ -193,11 +195,11 @@ contract('ERC20', function ([_, initialHolder, recipient, anotherAccount]) {
193
195
194
196
it ( 'increments totalSupply' , async function ( ) {
195
197
const expectedSupply = initialSupply . add ( amount ) ;
196
- ( await this . token . totalSupply ( ) ) . should . be . bignumber . equal ( expectedSupply ) ;
198
+ expect ( await this . token . totalSupply ( ) ) . to . be . bignumber . equal ( expectedSupply ) ;
197
199
} ) ;
198
200
199
201
it ( 'increments recipient balance' , async function ( ) {
200
- ( await this . token . balanceOf ( recipient ) ) . should . be . bignumber . equal ( amount ) ;
202
+ expect ( await this . token . balanceOf ( recipient ) ) . to . be . bignumber . equal ( amount ) ;
201
203
} ) ;
202
204
203
205
it ( 'emits Transfer event' , async function ( ) {
@@ -206,7 +208,7 @@ contract('ERC20', function ([_, initialHolder, recipient, anotherAccount]) {
206
208
to : recipient ,
207
209
} ) ;
208
210
209
- event . args . value . should . be . bignumber . equal ( amount ) ;
211
+ expect ( event . args . value ) . to . be . bignumber . equal ( amount ) ;
210
212
} ) ;
211
213
} ) ;
212
214
} ) ;
@@ -233,12 +235,12 @@ contract('ERC20', function ([_, initialHolder, recipient, anotherAccount]) {
233
235
234
236
it ( 'decrements totalSupply' , async function ( ) {
235
237
const expectedSupply = initialSupply . sub ( amount ) ;
236
- ( await this . token . totalSupply ( ) ) . should . be . bignumber . equal ( expectedSupply ) ;
238
+ expect ( await this . token . totalSupply ( ) ) . to . be . bignumber . equal ( expectedSupply ) ;
237
239
} ) ;
238
240
239
241
it ( 'decrements initialHolder balance' , async function ( ) {
240
242
const expectedBalance = initialSupply . sub ( amount ) ;
241
- ( await this . token . balanceOf ( initialHolder ) ) . should . be . bignumber . equal ( expectedBalance ) ;
243
+ expect ( await this . token . balanceOf ( initialHolder ) ) . to . be . bignumber . equal ( expectedBalance ) ;
242
244
} ) ;
243
245
244
246
it ( 'emits Transfer event' , async function ( ) {
@@ -247,7 +249,7 @@ contract('ERC20', function ([_, initialHolder, recipient, anotherAccount]) {
247
249
to : ZERO_ADDRESS ,
248
250
} ) ;
249
251
250
- event . args . value . should . be . bignumber . equal ( amount ) ;
252
+ expect ( event . args . value ) . to . be . bignumber . equal ( amount ) ;
251
253
} ) ;
252
254
} ) ;
253
255
} ;
@@ -294,17 +296,17 @@ contract('ERC20', function ([_, initialHolder, recipient, anotherAccount]) {
294
296
295
297
it ( 'decrements totalSupply' , async function ( ) {
296
298
const expectedSupply = initialSupply . sub ( amount ) ;
297
- ( await this . token . totalSupply ( ) ) . should . be . bignumber . equal ( expectedSupply ) ;
299
+ expect ( await this . token . totalSupply ( ) ) . to . be . bignumber . equal ( expectedSupply ) ;
298
300
} ) ;
299
301
300
302
it ( 'decrements initialHolder balance' , async function ( ) {
301
303
const expectedBalance = initialSupply . sub ( amount ) ;
302
- ( await this . token . balanceOf ( initialHolder ) ) . should . be . bignumber . equal ( expectedBalance ) ;
304
+ exxpect ( await this . token . balanceOf ( initialHolder ) ) . to . be . bignumber . equal ( expectedBalance ) ;
303
305
} ) ;
304
306
305
307
it ( 'decrements spender allowance' , async function ( ) {
306
308
const expectedAllowance = allowance . sub ( amount ) ;
307
- ( await this . token . allowance ( initialHolder , spender ) ) . should . be . bignumber . equal ( expectedAllowance ) ;
309
+ exxpect ( await this . token . allowance ( initialHolder , spender ) ) . to . be . bignumber . equal ( expectedAllowance ) ;
308
310
} ) ;
309
311
310
312
it ( 'emits a Transfer event' , async function ( ) {
@@ -313,7 +315,7 @@ contract('ERC20', function ([_, initialHolder, recipient, anotherAccount]) {
313
315
to : ZERO_ADDRESS ,
314
316
} ) ;
315
317
316
- event . args . value . should . be . bignumber . equal ( amount ) ;
318
+ expect ( event . args . value ) . to . be . bignumber . equal ( amount ) ;
317
319
} ) ;
318
320
319
321
it ( 'emits an Approval event' , async function ( ) {
0 commit comments