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
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
--- a/tests/src/refungible.test.ts
+++ b/tests/src/refungible.test.ts
@@ -62,7 +62,7 @@
       .to.eventually.be.rejectedWith(/refungible\.WrongRefungiblePieces/);
   });
   
-  itSub('RPC method tokenOnewrs for refungible collection and token', async ({helper}) => {
+  itSub('RPC method tokenOwners for refungible collection and token', async ({helper}) => {
     const ethAcc = {Ethereum: '0x67fb3503a61b284dc83fa96dceec4192db47dc7c'};
     const facelessCrowd = (await helper.arrange.createAccounts(Array(7).fill(0n), donor)).map(keyring => {return {Substrate: keyring.address};});
 
@@ -212,7 +212,8 @@
     const token = await collection.mintToken(alice, 100n);
     await token.repartition(alice, 200n);
     const chainEvents = helper.chainLog.slice(-1)[0].events;
-    expect(chainEvents).to.deep.include({
+    const event = chainEvents.find((event: any) => event.section === 'common' && event.method === 'ItemCreated');
+    expect(event).to.deep.include({
       section: 'common',
       method: 'ItemCreated',
       index: [66, 2],
@@ -222,7 +223,6 @@
         {substrate: alice.address}, 
         100n,
       ],
-      phase: {applyExtrinsic: 2},
     });
   });
 
@@ -231,9 +231,10 @@
     const token = await collection.mintToken(alice, 100n);
     await token.repartition(alice, 50n);
     const chainEvents = helper.chainLog.slice(-1)[0].events;
-    expect(chainEvents).to.deep.include({
+    const event = chainEvents.find((event: any) => event.section === 'common' && event.method === 'ItemDestroyed');
+    expect(event).to.deep.include({
+      section: 'common',
       method: 'ItemDestroyed',
-      section: 'common',
       index: [66, 3],
       data: [
         collection.collectionId,
@@ -241,7 +242,6 @@
         {substrate: alice.address}, 
         50n,
       ],
-      phase: {applyExtrinsic: 2},
     });
   });
   
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;