Skip to content

Commit

Permalink
Adjust collect-coins integration test to wait for extrinsic success
Browse files Browse the repository at this point in the history
  • Loading branch information
atodorov committed Nov 18, 2022
1 parent 8c80f5b commit e9e0136
Showing 1 changed file with 11 additions and 6 deletions.
17 changes: 11 additions & 6 deletions integration-tests/src/test/collect-coins.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import { creditcoinApi, POINT_01_CTC } from 'creditcoin-js';
import { Blockchain } from 'creditcoin-js/lib/model';
import { CreditcoinApi } from 'creditcoin-js/lib/types';
import { testData, registerCtcDeployerAddress } from 'creditcoin-js/lib/testUtils';
import { testIf } from '../utils';
import { extractFee, testIf } from '../utils';
import { createCreditcoinBlockchain } from 'creditcoin-js/lib/transforms';

describe('CollectCoins', (): void => {
Expand Down Expand Up @@ -144,11 +144,16 @@ describe('CollectCoins', (): void => {
CollectCoins: [collectedCoinsId, collectedCoins],
});

const { partialFee } = await api.tx.creditcoin
.persistTaskOutput(1000, taskOutput)
.paymentInfo(authority, { nonce: -1 });
/* eslint-enable */
expect(partialFee.toBigInt()).toBeGreaterThanOrEqual(POINT_01_CTC);
return new Promise((resolve, reject): void => {
const unsubscribe = api.tx.creditcoin
.persistTaskOutput(1000, taskOutput)
.signAndSend(authority, { nonce: -1 }, async ({ dispatchError, events, status }) => {
await extractFee(resolve, reject, unsubscribe, api, dispatchError, events, status);
})
.catch((error) => reject(error));
}).then((fee) => {
expect(fee).toBeGreaterThanOrEqual(POINT_01_CTC);
});
},
);
});
Expand Down

0 comments on commit e9e0136

Please sign in to comment.