@@ -186,6 +186,35 @@ contract('Market validation Mechanism', function(accounts) {
186
186
}
187
187
} ) ;
188
188
189
+ it ( 'can send tokens, but throws when tokens == 0' , async function ( ) {
190
+ const token = await LifToken . new ( { from : accounts [ 0 ] } ) ,
191
+ start = latestTime ( ) + 5 ,
192
+ mvm = await LifMarketValidationMechanism . new ( token . address , start ,
193
+ 100 , 24 , accounts [ 1 ] , { from : accounts [ 0 ] } ) ;
194
+
195
+ // mint some tokens, fund fails otherwise b/c it divides weiSent with tokenSupply
196
+ await token . mint ( accounts [ 5 ] , 100 , { from : accounts [ 0 ] } ) ;
197
+ await mvm . fund ( { value : 100 , from : accounts [ 0 ] } ) ; // it just works
198
+ await mvm . calculateDistributionPeriods ( ) ;
199
+
200
+ await increaseTimeTestRPCTo ( start ) ;
201
+
202
+ await token . approve ( mvm . address , 100 , { from : accounts [ 5 ] } ) ;
203
+
204
+ try {
205
+ await mvm . sendTokens ( 0 , { from : accounts [ 5 ] } ) ;
206
+ assert ( false , 'should have thrown' ) ;
207
+ } catch ( e ) {
208
+ assert ( help . isInvalidOpcodeEx ( e ) ) ;
209
+ }
210
+
211
+ assert . equal ( 100 , parseInt ( await token . totalSupply . call ( ) ) ) ;
212
+ await mvm . sendTokens ( 50 , { from : accounts [ 5 ] } ) ;
213
+
214
+ assert . equal ( 50 , parseInt ( await token . totalSupply . call ( ) ) ,
215
+ 'total supply has decrease to 50 because of burned tokens' ) ;
216
+ } ) ;
217
+
189
218
it ( 'Create 24 months MM' , async function ( ) {
190
219
const mmInitialBalance = 20000000 ;
191
220
const totalTokenSupply = 100 ;
0 commit comments