git.delta.rocks / unique-network / refs/commits / ce82ba0680fd

difftreelog

tests(parallel): fix phantom errors

Fahrrader2022-10-11parent: #d52c8f5.patch.diff
in: master

7 files changed

modifiedtests/src/approve.test.tsdiffbeforeafterboth
227 });227 });
228});228});
229229
230describe('Approved amount decreases by the transferred amount.:', () => {230describe('Approved amount decreases by the transferred amount:', () => {
231 let alice: IKeyringPair;231 let alice: IKeyringPair;
232 let bob: IKeyringPair;232 let bob: IKeyringPair;
233 let charlie: IKeyringPair;233 let charlie: IKeyringPair;
modifiedtests/src/confirmSponsorship.test.tsdiffbeforeafterboth
73 });73 });
7474
75 itSub('Fungible: Transfer fees are paid by the sponsor after confirmation', async ({helper}) => {75 itSub('Fungible: Transfer fees are paid by the sponsor after confirmation', async ({helper}) => {
76 const collection = await helper.ft.mintCollection(alice, {name: 'col', description: 'descr', tokenPrefix: 'COL'}, 0);76 const collection = await helper.ft.mintCollection(alice, {name: 'col', description: 'descr', tokenPrefix: 'COL'});
77 await collection.setSponsor(alice, bob.address);77 await collection.setSponsor(alice, bob.address);
78 await collection.confirmSponsorship(bob);78 await collection.confirmSponsorship(bob);
79 const bobBalanceBefore = await helper.balance.getSubstrate(bob.address);79 const bobBalanceBefore = await helper.balance.getSubstrate(bob.address);
163 });163 });
164164
165 itSub('NFT: Sponsoring of createItem is rate limited', async ({helper}) => {165 itSub('NFT: Sponsoring of createItem is rate limited', async ({helper}) => {
166 const collection = await helper.nft.mintCollection(alice, {name: 'col', description: 'descr', tokenPrefix: 'COL'});166 const collection = await helper.nft.mintCollection(alice, {name: 'col', description: 'descr', tokenPrefix: 'COL', limits: {
167 sponsoredDataRateLimit: {blocks: 1000},
168 sponsorTransferTimeout: 1000,
169 }});
167 await collection.setSponsor(alice, bob.address);170 await collection.setSponsor(alice, bob.address);
168 await collection.confirmSponsorship(bob);171 await collection.confirmSponsorship(bob);
169 await collection.setPermissions(alice, {mintMode: true, access: 'AllowList'});172 await collection.setPermissions(alice, {mintMode: true, access: 'AllowList'});
195 });198 });
196199
197 itSub('(!negative test!) Confirm sponsorship for a collection that never existed', async ({helper}) => {200 itSub('(!negative test!) Confirm sponsorship for a collection that never existed', async ({helper}) => {
198 const collectionId = 1_000_000;201 const collectionId = (1 << 32) - 1;
199 const confirmSponsorshipTx = async () => helper.collection.confirmSponsorship(bob, collectionId);202 const confirmSponsorshipTx = async () => helper.collection.confirmSponsorship(bob, collectionId);
200 await expect(confirmSponsorshipTx()).to.be.rejectedWith(/common\.CollectionNotFound/);203 await expect(confirmSponsorshipTx()).to.be.rejectedWith(/common\.CollectionNotFound/);
201 });204 });
modifiedtests/src/deprecated-helpers/helpers.tsdiffbeforeafterboth
1764 return (await api.rpc.unique.collectionById(collectionId)).unwrap();1764 return (await api.rpc.unique.collectionById(collectionId)).unwrap();
1765}1765}
17661766
1767/*export const describe_xcm = (1767export const describeXCM = (
1768 process.env.RUN_XCM_TESTS1768 process.env.RUN_XCM_TESTS
1769 ? describe1769 ? describe
1770 : describe.skip1770 : describe.skip
1771);*/1771);
17721772
1773export async function waitNewBlocks(blocksCount = 1): Promise<void> {1773export async function waitNewBlocks(blocksCount = 1): Promise<void> {
1774 await usingApi(async (api) => {1774 await usingApi(async (api) => {
modifiedtests/src/refungible.test.tsdiffbeforeafterboth
62 .to.eventually.be.rejectedWith(/refungible\.WrongRefungiblePieces/);62 .to.eventually.be.rejectedWith(/refungible\.WrongRefungiblePieces/);
63 });63 });
64 64
65 itSub('RPC method tokenOnewrs for refungible collection and token', async ({helper}) => {65 itSub('RPC method tokenOwners for refungible collection and token', async ({helper}) => {
66 const ethAcc = {Ethereum: '0x67fb3503a61b284dc83fa96dceec4192db47dc7c'};66 const ethAcc = {Ethereum: '0x67fb3503a61b284dc83fa96dceec4192db47dc7c'};
67 const facelessCrowd = (await helper.arrange.createAccounts(Array(7).fill(0n), donor)).map(keyring => {return {Substrate: keyring.address};});67 const facelessCrowd = (await helper.arrange.createAccounts(Array(7).fill(0n), donor)).map(keyring => {return {Substrate: keyring.address};});
6868
212 const token = await collection.mintToken(alice, 100n);212 const token = await collection.mintToken(alice, 100n);
213 await token.repartition(alice, 200n);213 await token.repartition(alice, 200n);
214 const chainEvents = helper.chainLog.slice(-1)[0].events;214 const chainEvents = helper.chainLog.slice(-1)[0].events;
215 const event = chainEvents.find((event: any) => event.section === 'common' && event.method === 'ItemCreated');
215 expect(chainEvents).to.deep.include({216 expect(event).to.deep.include({
216 section: 'common',217 section: 'common',
217 method: 'ItemCreated',218 method: 'ItemCreated',
218 index: [66, 2],219 index: [66, 2],
222 {substrate: alice.address}, 223 {substrate: alice.address},
223 100n,224 100n,
224 ],225 ],
225 phase: {applyExtrinsic: 2},
226 });226 });
227 });227 });
228228
231 const token = await collection.mintToken(alice, 100n);231 const token = await collection.mintToken(alice, 100n);
232 await token.repartition(alice, 50n);232 await token.repartition(alice, 50n);
233 const chainEvents = helper.chainLog.slice(-1)[0].events;233 const chainEvents = helper.chainLog.slice(-1)[0].events;
234 const event = chainEvents.find((event: any) => event.section === 'common' && event.method === 'ItemDestroyed');
234 expect(chainEvents).to.deep.include({235 expect(event).to.deep.include({
235 method: 'ItemDestroyed',236 section: 'common',
236 section: 'common',237 method: 'ItemDestroyed',
237 index: [66, 3],238 index: [66, 3],
238 data: [239 data: [
239 collection.collectionId,240 collection.collectionId,
240 token.tokenId,241 token.tokenId,
241 {substrate: alice.address}, 242 {substrate: alice.address},
242 50n,243 50n,
243 ],244 ],
244 phase: {applyExtrinsic: 2},
245 });245 });
246 });246 });
247 247
modifiedtests/src/xcm/xcmOpal.test.tsdiffbeforeafterboth
21import {ApiOptions} from '@polkadot/api/types';21import {ApiOptions} from '@polkadot/api/types';
22import {IKeyringPair} from '@polkadot/types/types';22import {IKeyringPair} from '@polkadot/types/types';
23import usingApi, {executeTransaction} from './../substrate/substrate-api';23import usingApi, {executeTransaction} from './../substrate/substrate-api';
24import {bigIntToDecimals, describe_xcm, getGenericResult, paraSiblingSovereignAccount, normalizeAccountId} from './../deprecated-helpers/helpers';24import {bigIntToDecimals, describeXCM, getGenericResult, paraSiblingSovereignAccount, normalizeAccountId} from './../deprecated-helpers/helpers';
25import waitNewBlocks from './../substrate/wait-new-blocks';25import waitNewBlocks from './../substrate/wait-new-blocks';
26import getBalance from './../substrate/get-balance';26import getBalance from './../substrate/get-balance';
2727
49// 10,000.00 (ten thousands) USDT49// 10,000.00 (ten thousands) USDT
50const ASSET_AMOUNT = 1_000_000_000_000_000_000_000n; 50const ASSET_AMOUNT = 1_000_000_000_000_000_000_000n;
5151
52describe_xcm('[XCM] Integration test: Exchanging USDT with Westmint', () => {52describeXCM('[XCM] Integration test: Exchanging USDT with Westmint', () => {
53 let alice: IKeyringPair;53 let alice: IKeyringPair;
54 let bob: IKeyringPair;54 let bob: IKeyringPair;
55 55
modifiedtests/src/xcm/xcmQuartz.test.tsdiffbeforeafterboth
21import {ApiOptions} from '@polkadot/api/types';21import {ApiOptions} from '@polkadot/api/types';
22import {IKeyringPair} from '@polkadot/types/types';22import {IKeyringPair} from '@polkadot/types/types';
23import usingApi, {submitTransactionAsync} from '../substrate/substrate-api';23import usingApi, {submitTransactionAsync} from '../substrate/substrate-api';
24import {getGenericResult, generateKeyringPair, waitEvent, describe_xcm, bigIntToDecimals} from '../deprecated-helpers/helpers';24import {getGenericResult, generateKeyringPair, waitEvent, describeXCM, bigIntToDecimals} from '../deprecated-helpers/helpers';
25import {MultiLocation} from '@polkadot/types/interfaces';25import {MultiLocation} from '@polkadot/types/interfaces';
26import {blake2AsHex} from '@polkadot/util-crypto';26import {blake2AsHex} from '@polkadot/util-crypto';
27import waitNewBlocks from '../substrate/wait-new-blocks';27import waitNewBlocks from '../substrate/wait-new-blocks';
61 return parachainApiOptions(RELAY_PORT);61 return parachainApiOptions(RELAY_PORT);
62}62}
6363
64describe_xcm('[XCM] Integration test: Exchanging tokens with Karura', () => {64describeXCM('[XCM] Integration test: Exchanging tokens with Karura', () => {
65 let alice: IKeyringPair;65 let alice: IKeyringPair;
66 let randomAccount: IKeyringPair;66 let randomAccount: IKeyringPair;
6767
292});292});
293293
294// These tests are relevant only when the foreign asset pallet is disabled294// These tests are relevant only when the foreign asset pallet is disabled
295describe_xcm('[XCM] Integration test: Quartz rejects non-native tokens', () => {295describeXCM('[XCM] Integration test: Quartz rejects non-native tokens', () => {
296 let alice: IKeyringPair;296 let alice: IKeyringPair;
297297
298 before(async () => {298 before(async () => {
433 });433 });
434});434});
435435
436describe_xcm('[XCM] Integration test: Exchanging QTZ with Moonriver', () => {436describeXCM('[XCM] Integration test: Exchanging QTZ with Moonriver', () => {
437437
438 // Quartz constants438 // Quartz constants
439 let quartzAlice: IKeyringPair;439 let quartzAlice: IKeyringPair;
modifiedtests/src/xcm/xcmUnique.test.tsdiffbeforeafterboth
21import {ApiOptions} from '@polkadot/api/types';21import {ApiOptions} from '@polkadot/api/types';
22import {IKeyringPair} from '@polkadot/types/types';22import {IKeyringPair} from '@polkadot/types/types';
23import usingApi, {submitTransactionAsync} from '../substrate/substrate-api';23import usingApi, {submitTransactionAsync} from '../substrate/substrate-api';
24import {getGenericResult, generateKeyringPair, waitEvent, describe_xcm, bigIntToDecimals} from '../deprecated-helpers/helpers';24import {getGenericResult, generateKeyringPair, waitEvent, describeXCM, bigIntToDecimals} from '../deprecated-helpers/helpers';
25import {MultiLocation} from '@polkadot/types/interfaces';25import {MultiLocation} from '@polkadot/types/interfaces';
26import {blake2AsHex} from '@polkadot/util-crypto';26import {blake2AsHex} from '@polkadot/util-crypto';
27import waitNewBlocks from '../substrate/wait-new-blocks';27import waitNewBlocks from '../substrate/wait-new-blocks';
61 return parachainApiOptions(RELAY_PORT);61 return parachainApiOptions(RELAY_PORT);
62}62}
6363
64describe_xcm('[XCM] Integration test: Exchanging tokens with Acala', () => {64describeXCM('[XCM] Integration test: Exchanging tokens with Acala', () => {
65 let alice: IKeyringPair;65 let alice: IKeyringPair;
66 let randomAccount: IKeyringPair;66 let randomAccount: IKeyringPair;
6767
292});292});
293293
294// These tests are relevant only when the foreign asset pallet is disabled294// These tests are relevant only when the foreign asset pallet is disabled
295describe_xcm('[XCM] Integration test: Unique rejects non-native tokens', () => {295describeXCM('[XCM] Integration test: Unique rejects non-native tokens', () => {
296 let alice: IKeyringPair;296 let alice: IKeyringPair;
297297
298 before(async () => {298 before(async () => {
433 });433 });
434});434});
435435
436describe_xcm('[XCM] Integration test: Exchanging UNQ with Moonbeam', () => {436describeXCM('[XCM] Integration test: Exchanging UNQ with Moonbeam', () => {
437437
438 // Unique constants438 // Unique constants
439 let uniqueAlice: IKeyringPair;439 let uniqueAlice: IKeyringPair;