git.delta.rocks / unique-network / refs/commits / 266e5f54ea4d

difftreelog

fix adjust tests

Daniel Shiposha2022-06-14parent: #4efbbf7.patch.diff
in: master

2 files changed

modifiedtests/src/pallet-presence.test.tsdiffbeforeafterboth
23}23}
2424
25// Pallets that must always be present25// Pallets that must always be present
26const requiredPallets = [26let requiredPallets = [
27 'balances',27 'balances',
28 'common',28 'common',
29 'randomnesscollectiveflip',29 'randomnesscollectiveflip',
50 'unique',50 'unique',
51 'nonfungible',51 'nonfungible',
52 'refungible',52 'refungible',
53 'rmrkcore',
54 'rmrkequip',
55 'scheduler',53 'scheduler',
56 'charging',54 'charging',
57];55];
64];62];
6563
66describe('Pallet presence', () => {64describe('Pallet presence', () => {
65 before(async () => {
66 await usingApi(async api => {
67 const chain = await api.rpc.system.chain();
68
69 if (!chain.eq('UNIQUE')) {
70 requiredPallets.push(...['rmrkcore', 'rmrkequip']);
71 }
72 });
73 });
74
67 it('Required pallets are present', async () => {75 it('Required pallets are present', async () => {
68 await usingApi(async api => {76 await usingApi(async api => {
modifiedtests/src/rmrk/rmrk.test.tsdiffbeforeafterboth
--- a/tests/src/rmrk/rmrk.test.ts
+++ b/tests/src/rmrk/rmrk.test.ts
@@ -11,6 +11,7 @@
 } from '../util/helpers';
 import {IKeyringPair} from '@polkadot/types/types';
 import {ApiPromise} from '@polkadot/api';
+import { it } from 'mocha';
 
 let alice: IKeyringPair;
 let bob: IKeyringPair;
@@ -48,14 +49,26 @@
   return result.data!;
 }
 
-describe('RMRK External Integration Test', () => {
+async function isUnique(): Promise<boolean> {
+  return usingApi(async api => {
+    const chain = await api.rpc.system.chain();
+
+    return chain.eq('UNIQUE')
+  })
+}
+
+describe('RMRK External Integration Test', async () => {
+  let it_rmrk = (await isUnique() ? it : it.skip);
+
   before(async () => {
     await usingApi(async (api, privateKeyWrapper) => {
       alice = privateKeyWrapper('//Alice');
+
+      
     });
   });
 
-  it('Creates a new RMRK collection that is mapped to a different ID and is tagged as external', async () => {
+  it_rmrk('Creates a new RMRK collection that is mapped to a different ID and is tagged as external', async () => {
     await usingApi(async api => {
       // throwaway collection to bump last Unique collection ID to test ID mapping
       await createCollectionExpectSuccess();
@@ -70,11 +83,13 @@
   });
 });
 
-describe('Negative Integration Test: External Collections, Internal Ops', () => {
+describe('Negative Integration Test: External Collections, Internal Ops', async () => {
   let uniqueCollectionId: number;
   let rmrkCollectionId: number;
   let rmrkNftId: number;
 
+  let it_rmrk = (await isUnique() ? it : it.skip);
+
   before(async () => {
     await usingApi(async (api, privateKeyWrapper) => {
       alice = privateKeyWrapper('//Alice');
@@ -88,7 +103,7 @@
     });
   });
 
-  it('[Negative] Forbids Unique operations with an external collection, handled by dispatch_call', async () => {
+  it_rmrk('[Negative] Forbids Unique operations with an external collection, handled by dispatch_call', async () => {
     await usingApi(async api => {
       // Collection item creation
 
@@ -147,7 +162,7 @@
     });
   });
 
-  it('[Negative] Forbids Unique collection operations with an external collection', async () => {
+  it_rmrk('[Negative] Forbids Unique collection operations with an external collection', async () => {
     await usingApi(async api => {
       const txDestroyCollection = api.tx.unique.destroyCollection(uniqueCollectionId);
       await expect(executeTransaction(api, alice, txDestroyCollection), 'destroying collection')
@@ -206,10 +221,12 @@
   });
 });
 
-describe('Negative Integration Test: Internal Collections, External Ops', () => {
+describe('Negative Integration Test: Internal Collections, External Ops', async () => {
   let collectionId: number;
   let nftId: number;
 
+  let it_rmrk = (await isUnique() ? it : it.skip);
+
   before(async () => {
     await usingApi(async (api, privateKeyWrapper) => {
       alice = privateKeyWrapper('//Alice');
@@ -220,7 +237,7 @@
     });
   });
 
-  it('[Negative] Forbids RMRK operations with the internal collection and NFT (due to the lack of mapping)', async () => {
+  it_rmrk('[Negative] Forbids RMRK operations with the internal collection and NFT (due to the lack of mapping)', async () => {
     await usingApi(async api => {
       const txChangeOwner = api.tx.rmrkCore.changeCollectionIssuer(collectionId, bob.address);
       await expect(executeTransaction(api, alice, txChangeOwner), 'changing collection issuer')