@@ -441,7 +441,7 @@ describe('cnft tests', () => {
441441 getCnftRef,
442442 nft,
443443 creatorRoyalties,
444- collectionKey
444+ collectionKey,
445445 } = await setupTree (
446446 umi ,
447447 publicKey ( seller . publicKey ) ,
@@ -638,27 +638,23 @@ describe('cnft tests', () => {
638638 . rpc ( /* { skipPreflight: true } */ ) ;
639639 console . log ( `fulfillBuyTxnSig: ${ fulfillBuyTxnSig } ` ) ;
640640 } catch ( e ) {
641- if ( e instanceof SendTransactionError ) {
642- const err = e as SendTransactionError ;
643- console . log (
644- `err.logs: ${ JSON . stringify (
645- await err . getLogs ( provider . connection ) ,
646- null ,
647- 2 ,
648- ) } `,
649- ) ;
650- }
651- throw e ;
641+ expect ( e ) . toBeInstanceOf ( anchor . AnchorError ) ;
642+ const err = e as anchor . AnchorError ;
643+
644+ assert . strictEqual (
645+ err . message ,
646+ 'AnchorError occurred. Error Code: InvalidAllowLists. Error Number: 6001. Error Message: invalid allowlists.' ,
647+ ) ;
652648 }
653649
654650 console . log ( `seller: ${ seller . publicKey } ` ) ;
655651 console . log ( `buyer: ${ buyer . publicKey } ` ) ;
656652 console . log ( `nft: ${ JSON . stringify ( nft ) } ` ) ;
657- // Verify that buyer now owns the cNFT.
653+ // Verify that seller still owns the cNFT.
658654 await verifyOwnership (
659655 umi ,
660656 merkleTree ,
661- publicKey ( buyer . publicKey ) ,
657+ publicKey ( seller . publicKey ) ,
662658 leafIndex ,
663659 metadata ,
664660 [ ] ,
@@ -687,41 +683,19 @@ describe('cnft tests', () => {
687683 console . log ( `creator1After: ${ creator1After } ` ) ;
688684 console . log ( `creator2After: ${ creator2After } ` ) ;
689685
690- const expectedTxFees = SIGNATURE_FEE_LAMPORTS * 3 ; // cosigner + seller + payer (due to provider is under buyer)
691-
692- assert . equal ( buyerBefore , buyerAfter + expectedTxFees ) ;
686+ assert . equal ( buyerBefore , buyerAfter ) ;
693687
694688 assert . equal (
695689 buyerSolEscrowAccountBalanceBefore ,
696- buyerSolEscrowAccountBalanceAfter + spotPrice * LAMPORTS_PER_SOL ,
690+ buyerSolEscrowAccountBalanceAfter ,
697691 ) ;
698692
699693 // In production it should be seller buy tx fee, but with this test set up, buyer pays
700694 // tx fee due to provider is initiated under buyer.
701- assert . equal (
702- sellerAfter ,
703- sellerBefore +
704- spotPrice * LAMPORTS_PER_SOL -
705- expectedBuyPrices . takerFeePaid . toNumber ( ) -
706- expectedBuyPrices . royaltyPaid . toNumber ( ) ,
707- ) ;
695+ assert . equal ( sellerAfter , sellerBefore ) ;
708696
709- assertIsBetween (
710- creator1After ,
711- creator1Before +
712- ( expectedBuyPrices . royaltyPaid . toNumber ( ) *
713- metadata . creators [ 0 ] . share ) /
714- 100 ,
715- PRICE_ERROR_RANGE ,
716- ) ;
697+ assert . equal ( creator1After , creator1Before ) ;
717698
718- assertIsBetween (
719- creator2After ,
720- creator2Before +
721- ( expectedBuyPrices . royaltyPaid . toNumber ( ) *
722- metadata . creators [ 1 ] . share ) /
723- 100 ,
724- PRICE_ERROR_RANGE ,
725- ) ;
699+ assert . equal ( creator2After , creator2Before ) ;
726700 } ) ;
727701} ) ;
0 commit comments