@@ -173,6 +173,10 @@ contract("{Set}", (accounts) => {
173
173
} ) ;
174
174
175
175
describe ( "of Sets with fractional units" , ( ) => {
176
+ beforeEach ( async ( ) => {
177
+ componentA = await StandardTokenMock . new ( testAccount , initialTokens , "Component A" , "A" ) ;
178
+ } ) ;
179
+
176
180
it ( "should be able to issue and redeem a Set defined with a fractional unit" , async ( ) => {
177
181
const halfGWeiUnits = gWei ( 1 ) . div ( 2 ) ; // Represents half a gWei
178
182
@@ -192,13 +196,13 @@ contract("{Set}", (accounts) => {
192
196
193
197
await setToken . issue ( quantityInWei , TX_DEFAULTS ) ;
194
198
195
- assertTokenBalance ( componentA , initialTokens . sub ( quantityA ) , testAccount ) ;
196
- assertTokenBalance ( setToken , quantityInWei , testAccount ) ;
199
+ assertTokenBalance ( componentA , initialTokens . sub ( quantityA ) , testAccount , "Component A after issue" ) ;
200
+ assertTokenBalance ( setToken , quantityInWei , testAccount , "Set Token after issue" ) ;
197
201
198
202
await setToken . redeem ( quantityInWei , TX_DEFAULTS ) ;
199
203
200
- assertTokenBalance ( componentA , initialTokens , testAccount ) ;
201
- assertTokenBalance ( setToken , new BigNumber ( 0 ) , testAccount ) ;
204
+ assertTokenBalance ( componentA , initialTokens , testAccount , "A after redeem" ) ;
205
+ assertTokenBalance ( setToken , new BigNumber ( 0 ) , testAccount , "Set after redeem" ) ;
202
206
} ) ;
203
207
204
208
it ( "should disallow issuing a Set when the amount is too low" , async ( ) => {
@@ -256,7 +260,7 @@ contract("{Set}", (accounts) => {
256
260
let quantityB : BigNumber ;
257
261
let quantityC : BigNumber ;
258
262
259
- // Create a Set two components with set tokens issued
263
+ // Create a Set with three components with set tokens issued
260
264
beforeEach ( async ( ) => {
261
265
componentA = await StandardTokenMock . new ( testAccount , initialTokens , "Component A" , "A" ) ;
262
266
componentB = await StandardTokenMock . new ( testAccount , initialTokens , "Component B" , "B" ) ;
@@ -305,6 +309,20 @@ contract("{Set}", (accounts) => {
305
309
TX_DEFAULTS ,
306
310
) ) ;
307
311
} ) ;
312
+
313
+ it ( "should fail if there are no exclusions" , async ( ) => {
314
+ await expectRevertError ( setToken . partialRedeem ( quantityIssued , [ ] , TX_DEFAULTS ) ) ;
315
+ } ) ;
316
+
317
+ it ( "should fail if an excluded token is invalid" , async ( ) => {
318
+ const INVALID_ADDRESS = "0x0000000000000000000000000000000000000001" ;
319
+
320
+ await expectInvalidOpcodeError ( setToken . partialRedeem (
321
+ quantityIssued ,
322
+ [ componentA . address , INVALID_ADDRESS ] ,
323
+ TX_DEFAULTS ,
324
+ ) ) ;
325
+ } ) ;
308
326
} ) ;
309
327
310
328
describe ( "Redeem Excluded" , async ( ) => {
@@ -346,5 +364,14 @@ contract("{Set}", (accounts) => {
346
364
const [ excludedBalanceAofOwner ] = await setToken . unredeemedComponents ( componentA . address , testAccount ) ;
347
365
expect ( excludedBalanceAofOwner ) . to . be . bignumber . equal ( 0 ) ;
348
366
} ) ;
367
+
368
+ it ( "should fail if the user doesn't have enough balance" , async ( ) => {
369
+ const largeQuantity = new BigNumber ( "1000000000000000000000000000000000000" ) ;
370
+ expectRevertError ( setToken . redeemExcluded (
371
+ largeQuantity ,
372
+ componentA . address ,
373
+ TX_DEFAULTS ,
374
+ ) ) ;
375
+ } ) ;
349
376
} ) ;
350
377
} ) ;
0 commit comments