@@ -15,6 +15,7 @@ import {
1515
1616import { TestFactory } from '~/helpers' ;
1717import { createNftCollection } from '~/sdk/assets/createNftCollection' ;
18+ import { awaitMiddlewareSynced } from '~/util' ;
1819
1920let factory : TestFactory ;
2021
@@ -54,20 +55,20 @@ describe('manageNft', () => {
5455
5556 receiver = await sdk . identities . getIdentity ( { did : receiverDid } ) ;
5657
57- const portfolioProc = await sdk . identities . createPortfolio ( { name : 'NFT portfolio' } ) ;
58+ const portfolioTx = await sdk . identities . createPortfolio ( { name : 'NFT portfolio' } ) ;
5859
59- const venueProc = await sdk . settlements . createVenue ( {
60+ const venueTx = await sdk . settlements . createVenue ( {
6061 description : 'test exchange' ,
6162 type : VenueType . Exchange ,
6263 } ) ;
6364
64- const pauseProc = await collection . compliance . requirements . pause ( ) ;
65+ const pauseTx = await collection . compliance . requirements . pause ( ) ;
6566
66- const batchProc = await sdk . createTransactionBatch ( {
67- transactions : [ portfolioProc , venueProc , pauseProc ] as const ,
67+ const batchTx = await sdk . createTransactionBatch ( {
68+ transactions : [ portfolioTx , venueTx , pauseTx ] as const ,
6869 } ) ;
6970
70- [ portfolio , venue ] = await batchProc . run ( ) ;
71+ [ portfolio , venue ] = await batchTx . run ( ) ;
7172
7273 // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
7374 holder = ( await sdk . getSigningIdentity ( ) ) ! ;
@@ -96,7 +97,7 @@ describe('manageNft', () => {
9697 } ) ;
9798
9899 it ( 'should issue an Nft' , async ( ) => {
99- const issueProc = await collection . issue ( {
100+ const issueTx = await collection . issue ( {
100101 metadata : [
101102 { type : MetadataType . Local , id : new BigNumber ( 1 ) , value : 'https://example.com/nft/1' } ,
102103 {
@@ -107,13 +108,13 @@ describe('manageNft', () => {
107108 ] ,
108109 } ) ;
109110
110- nft = await issueProc . run ( ) ;
111+ nft = await issueTx . run ( ) ;
111112
112113 expect ( nft . id ) . toEqual ( new BigNumber ( 1 ) ) ;
113114 } ) ;
114115
115116 it ( 'should allow holder to transfer NFTs between portfolios' , async ( ) => {
116- const moveProc = await defaultPortfolio . moveFunds ( {
117+ const moveTx = await defaultPortfolio . moveFunds ( {
117118 to : portfolio ,
118119 items : [
119120 {
@@ -123,7 +124,7 @@ describe('manageNft', () => {
123124 ] ,
124125 } ) ;
125126
126- await moveProc . run ( ) ;
127+ await moveTx . run ( ) ;
127128
128129 const [ defaultCollections , portfolioCollections ] = await Promise . all ( [
129130 defaultPortfolio . getCollections ( ) ,
@@ -152,7 +153,7 @@ describe('manageNft', () => {
152153 } ) ;
153154
154155 it ( 'should let the holder send instructions with an NFT' , async ( ) => {
155- const instructionProc = await sdk . settlements . addInstruction ( {
156+ const instructionTx = await sdk . settlements . addInstruction ( {
156157 venueId : venue . id ,
157158 legs : [
158159 {
@@ -164,12 +165,9 @@ describe('manageNft', () => {
164165 ] ,
165166 } ) ;
166167
167- const middlewareSynced = ( ) =>
168- new Promise ( ( resolve ) => instructionProc . onProcessedByMiddleware ( resolve ) ) ;
168+ instruction = await instructionTx . run ( ) ;
169169
170- instruction = await instructionProc . run ( ) ;
171-
172- await middlewareSynced ( ) ;
170+ await awaitMiddlewareSynced ( instructionTx , sdk ) ;
173171 } ) ;
174172
175173 it ( 'should return legs for an instruction when they contain an NFT' , async ( ) => {
@@ -188,8 +186,8 @@ describe('manageNft', () => {
188186 } ) ;
189187
190188 it ( 'should allow the receiver to accept an NFT settlement' , async ( ) => {
191- const affirmProc = await instruction . affirm ( { } , { signingAccount : receiverAddress } ) ;
192- await affirmProc . run ( ) ;
189+ const affirmTx = await instruction . affirm ( { } , { signingAccount : receiverAddress } ) ;
190+ await affirmTx . run ( ) ;
193191
194192 const receiverPortfolio = await receiver . portfolios . getPortfolio ( ) ;
195193
@@ -209,7 +207,7 @@ describe('manageNft', () => {
209207 } ) ;
210208
211209 it ( 'should allow the issuer to redeem an NFT' , async ( ) => {
212- const createNftProc = await collection . issue ( {
210+ const createNftTx = await collection . issue ( {
213211 metadata : [
214212 { type : MetadataType . Local , id : new BigNumber ( 1 ) , value : 'https://example.com/nft/1' } ,
215213 {
@@ -220,10 +218,10 @@ describe('manageNft', () => {
220218 ] ,
221219 } ) ;
222220
223- const redeemNft = await createNftProc . run ( ) ;
221+ const redeemNft = await createNftTx . run ( ) ;
224222
225- const redeemProc = await redeemNft . redeem ( ) ;
223+ const redeemTx = await redeemNft . redeem ( ) ;
226224
227- expect ( redeemProc . run ( ) ) . resolves . not . toThrow ( ) ;
225+ expect ( redeemTx . run ( ) ) . resolves . not . toThrow ( ) ;
228226 } ) ;
229227} ) ;
0 commit comments