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
--- a/tests/src/approve.test.ts
+++ b/tests/src/approve.test.ts
@@ -227,7 +227,7 @@
   });
 });
 
-describe('Approved amount decreases by the transferred amount.:', () => {
+describe('Approved amount decreases by the transferred amount:', () => {
   let alice: IKeyringPair;
   let bob: IKeyringPair;
   let charlie: IKeyringPair;
modifiedtests/src/confirmSponsorship.test.tsdiffbeforeafterboth
--- a/tests/src/confirmSponsorship.test.ts
+++ b/tests/src/confirmSponsorship.test.ts
@@ -73,7 +73,7 @@
   });
 
   itSub('Fungible: Transfer fees are paid by the sponsor after confirmation', async ({helper}) => {
-    const collection = await helper.ft.mintCollection(alice, {name: 'col', description: 'descr', tokenPrefix: 'COL'}, 0);
+    const collection = await helper.ft.mintCollection(alice, {name: 'col', description: 'descr', tokenPrefix: 'COL'});
     await collection.setSponsor(alice, bob.address);
     await collection.confirmSponsorship(bob);
     const bobBalanceBefore = await helper.balance.getSubstrate(bob.address);
@@ -163,7 +163,10 @@
   });
 
   itSub('NFT: Sponsoring of createItem is rate limited', async ({helper}) => {
-    const collection = await helper.nft.mintCollection(alice, {name: 'col', description: 'descr', tokenPrefix: 'COL'});
+    const collection = await helper.nft.mintCollection(alice, {name: 'col', description: 'descr', tokenPrefix: 'COL', limits: {
+      sponsoredDataRateLimit: {blocks: 1000},
+      sponsorTransferTimeout: 1000,
+    }});
     await collection.setSponsor(alice, bob.address);
     await collection.confirmSponsorship(bob);
     await collection.setPermissions(alice, {mintMode: true, access: 'AllowList'});
@@ -195,7 +198,7 @@
   });
 
   itSub('(!negative test!) Confirm sponsorship for a collection that never existed', async ({helper}) => {
-    const collectionId = 1_000_000;
+    const collectionId = (1 << 32) - 1;
     const confirmSponsorshipTx = async () => helper.collection.confirmSponsorship(bob, collectionId);
     await expect(confirmSponsorshipTx()).to.be.rejectedWith(/common\.CollectionNotFound/);
   });
modifiedtests/src/deprecated-helpers/helpers.tsdiffbeforeafterboth
--- a/tests/src/deprecated-helpers/helpers.ts
+++ b/tests/src/deprecated-helpers/helpers.ts
@@ -1764,11 +1764,11 @@
   return (await api.rpc.unique.collectionById(collectionId)).unwrap();
 }
 
-/*export const describe_xcm = (
+export const describeXCM = (
   process.env.RUN_XCM_TESTS
     ? describe
     : describe.skip
-);*/
+);
 
 export async function waitNewBlocks(blocksCount = 1): Promise<void> {
   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
--- a/tests/src/xcm/xcmOpal.test.ts
+++ b/tests/src/xcm/xcmOpal.test.ts
@@ -21,7 +21,7 @@
 import {ApiOptions} from '@polkadot/api/types';
 import {IKeyringPair} from '@polkadot/types/types';
 import usingApi, {executeTransaction} from './../substrate/substrate-api';
-import {bigIntToDecimals, describe_xcm, getGenericResult, paraSiblingSovereignAccount, normalizeAccountId} from './../deprecated-helpers/helpers';
+import {bigIntToDecimals, describeXCM, getGenericResult, paraSiblingSovereignAccount, normalizeAccountId} from './../deprecated-helpers/helpers';
 import waitNewBlocks from './../substrate/wait-new-blocks';
 import getBalance from './../substrate/get-balance';
 
@@ -49,7 +49,7 @@
 // 10,000.00 (ten thousands) USDT
 const ASSET_AMOUNT = 1_000_000_000_000_000_000_000n; 
 
-describe_xcm('[XCM] Integration test: Exchanging USDT with Westmint', () => {
+describeXCM('[XCM] Integration test: Exchanging USDT with Westmint', () => {
   let alice: IKeyringPair;
   let bob: IKeyringPair;
   
modifiedtests/src/xcm/xcmQuartz.test.tsdiffbeforeafterboth
--- a/tests/src/xcm/xcmQuartz.test.ts
+++ b/tests/src/xcm/xcmQuartz.test.ts
@@ -21,7 +21,7 @@
 import {ApiOptions} from '@polkadot/api/types';
 import {IKeyringPair} from '@polkadot/types/types';
 import usingApi, {submitTransactionAsync} from '../substrate/substrate-api';
-import {getGenericResult, generateKeyringPair, waitEvent, describe_xcm, bigIntToDecimals} from '../deprecated-helpers/helpers';
+import {getGenericResult, generateKeyringPair, waitEvent, describeXCM, bigIntToDecimals} from '../deprecated-helpers/helpers';
 import {MultiLocation} from '@polkadot/types/interfaces';
 import {blake2AsHex} from '@polkadot/util-crypto';
 import waitNewBlocks from '../substrate/wait-new-blocks';
@@ -61,7 +61,7 @@
   return parachainApiOptions(RELAY_PORT);
 }
 
-describe_xcm('[XCM] Integration test: Exchanging tokens with Karura', () => {
+describeXCM('[XCM] Integration test: Exchanging tokens with Karura', () => {
   let alice: IKeyringPair;
   let randomAccount: IKeyringPair;
 
@@ -292,7 +292,7 @@
 });
 
 // These tests are relevant only when the foreign asset pallet is disabled
-describe_xcm('[XCM] Integration test: Quartz rejects non-native tokens', () => {
+describeXCM('[XCM] Integration test: Quartz rejects non-native tokens', () => {
   let alice: IKeyringPair;
 
   before(async () => {
@@ -433,7 +433,7 @@
   });
 });
 
-describe_xcm('[XCM] Integration test: Exchanging QTZ with Moonriver', () => {
+describeXCM('[XCM] Integration test: Exchanging QTZ with Moonriver', () => {
 
   // Quartz constants
   let quartzAlice: IKeyringPair;
modifiedtests/src/xcm/xcmUnique.test.tsdiffbeforeafterboth
--- a/tests/src/xcm/xcmUnique.test.ts
+++ b/tests/src/xcm/xcmUnique.test.ts
@@ -21,7 +21,7 @@
 import {ApiOptions} from '@polkadot/api/types';
 import {IKeyringPair} from '@polkadot/types/types';
 import usingApi, {submitTransactionAsync} from '../substrate/substrate-api';
-import {getGenericResult, generateKeyringPair, waitEvent, describe_xcm, bigIntToDecimals} from '../deprecated-helpers/helpers';
+import {getGenericResult, generateKeyringPair, waitEvent, describeXCM, bigIntToDecimals} from '../deprecated-helpers/helpers';
 import {MultiLocation} from '@polkadot/types/interfaces';
 import {blake2AsHex} from '@polkadot/util-crypto';
 import waitNewBlocks from '../substrate/wait-new-blocks';
@@ -61,7 +61,7 @@
   return parachainApiOptions(RELAY_PORT);
 }
 
-describe_xcm('[XCM] Integration test: Exchanging tokens with Acala', () => {
+describeXCM('[XCM] Integration test: Exchanging tokens with Acala', () => {
   let alice: IKeyringPair;
   let randomAccount: IKeyringPair;
 
@@ -292,7 +292,7 @@
 });
 
 // These tests are relevant only when the foreign asset pallet is disabled
-describe_xcm('[XCM] Integration test: Unique rejects non-native tokens', () => {
+describeXCM('[XCM] Integration test: Unique rejects non-native tokens', () => {
   let alice: IKeyringPair;
 
   before(async () => {
@@ -433,7 +433,7 @@
   });
 });
 
-describe_xcm('[XCM] Integration test: Exchanging UNQ with Moonbeam', () => {
+describeXCM('[XCM] Integration test: Exchanging UNQ with Moonbeam', () => {
 
   // Unique constants
   let uniqueAlice: IKeyringPair;