@@ -174,6 +174,7 @@ test('create new token', async () => {
174174 expect ( accountInfo . owner . equals ( initialOwner . publicKey ) ) . toBe ( true ) ;
175175 expect ( accountInfo . amount . toNumber ( ) ) . toBe ( 10000 ) ;
176176 expect ( accountInfo . source ) . toBe ( null ) ;
177+ expect ( accountInfo . originalAmount . toNumber ( ) ) . toBe ( 0 ) ;
177178} ) ;
178179
179180
@@ -379,6 +380,7 @@ test('approve/revoke', async () => {
379380 200 , 1 , 0 , 0 , 0 , 0 , 0 , 0 ,
380381 1 ,
381382 ...initialOwnerTokenAccount . toBuffer ( ) ,
383+ 200 , 1 , 0 , 0 , 0 , 0 , 0 , 0 ,
382384 ] ,
383385 executable : false ,
384386 loader_program_id : [
@@ -393,6 +395,7 @@ test('approve/revoke', async () => {
393395 let delegateAccountInfo = await testToken . accountInfo ( delegate ) ;
394396
395397 expect ( delegateAccountInfo . amount . toNumber ( ) ) . toBe ( 456 ) ;
398+ expect ( delegateAccountInfo . originalAmount . toNumber ( ) ) . toBe ( 456 ) ;
396399 if ( delegateAccountInfo . source === null ) {
397400 throw new Error ( 'source should not be null' ) ;
398401 } else {
@@ -432,6 +435,7 @@ test('approve/revoke', async () => {
432435 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 ,
433436 1 ,
434437 ...initialOwnerTokenAccount . toBuffer ( ) ,
438+ 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 ,
435439 ] ,
436440 executable : false ,
437441 loader_program_id : [
@@ -444,8 +448,8 @@ test('approve/revoke', async () => {
444448 }
445449
446450 delegateAccountInfo = await testToken . accountInfo ( delegate ) ;
447-
448451 expect ( delegateAccountInfo . amount . toNumber ( ) ) . toBe ( 0 ) ;
452+ expect ( delegateAccountInfo . originalAmount . toNumber ( ) ) . toBe ( 0 ) ;
449453 if ( delegateAccountInfo . source === null ) {
450454 throw new Error ( 'source should not be null' ) ;
451455 } else {
@@ -517,20 +521,32 @@ test.skip('fail on approve overspend', async () => {
517521 2
518522 ) ;
519523
524+ let delegateAccountInfo = await testToken . accountInfo ( account1Delegate ) ;
525+ expect ( delegateAccountInfo . amount . toNumber ( ) ) . toBe ( 2 ) ;
526+ expect ( delegateAccountInfo . originalAmount . toNumber ( ) ) . toBe ( 2 ) ;
527+
520528 await testToken . transfer (
521529 owner ,
522530 account1Delegate ,
523531 account2 ,
524532 1 ,
525533 ) ;
526534
535+ delegateAccountInfo = await testToken . accountInfo ( account1Delegate ) ;
536+ expect ( delegateAccountInfo . amount . toNumber ( ) ) . toBe ( 1 ) ;
537+ expect ( delegateAccountInfo . originalAmount . toNumber ( ) ) . toBe ( 2 ) ;
538+
527539 await testToken . transfer (
528540 owner ,
529541 account1Delegate ,
530542 account2 ,
531543 1 ,
532544 ) ;
533545
546+ delegateAccountInfo = await testToken . accountInfo ( account1Delegate ) ;
547+ expect ( delegateAccountInfo . amount . toNumber ( ) ) . toBe ( 0 ) ;
548+ expect ( delegateAccountInfo . originalAmount . toNumber ( ) ) . toBe ( 2 ) ;
549+
534550 expect (
535551 testToken . transfer (
536552 owner ,
0 commit comments