difftreelog
fix adjust tests
in: master
2 files changed
tests/src/pallet-presence.test.tsdiffbeforeafterboth--- a/tests/src/pallet-presence.test.ts
+++ b/tests/src/pallet-presence.test.ts
@@ -23,7 +23,7 @@
}
// Pallets that must always be present
-const requiredPallets = [
+let requiredPallets = [
'balances',
'common',
'randomnesscollectiveflip',
@@ -50,8 +50,6 @@
'unique',
'nonfungible',
'refungible',
- 'rmrkcore',
- 'rmrkequip',
'scheduler',
'charging',
];
@@ -64,6 +62,16 @@
];
describe('Pallet presence', () => {
+ before(async () => {
+ await usingApi(async api => {
+ const chain = await api.rpc.system.chain();
+
+ if (!chain.eq('UNIQUE')) {
+ requiredPallets.push(...['rmrkcore', 'rmrkequip']);
+ }
+ });
+ });
+
it('Required pallets are present', async () => {
await usingApi(async api => {
for (let i=0; i<requiredPallets.length; i++) {
tests/src/rmrk/rmrk.test.tsdiffbeforeafterboth11} from '../util/helpers';11} from '../util/helpers';12import {IKeyringPair} from '@polkadot/types/types';12import {IKeyringPair} from '@polkadot/types/types';13import {ApiPromise} from '@polkadot/api';13import {ApiPromise} from '@polkadot/api';14import { it } from 'mocha';141515let alice: IKeyringPair;16let alice: IKeyringPair;16let bob: IKeyringPair;17let bob: IKeyringPair;48 return result.data!;49 return result.data!;49}50}5152async function isUnique(): Promise<boolean> {53 return usingApi(async api => {54 const chain = await api.rpc.system.chain();5556 return chain.eq('UNIQUE')57 })58}505951describe('RMRK External Integration Test', () => {60describe('RMRK External Integration Test', async () => {61 let it_rmrk = (await isUnique() ? it : it.skip);6252 before(async () => {63 before(async () => {53 await usingApi(async (api, privateKeyWrapper) => {64 await usingApi(async (api, privateKeyWrapper) => {54 alice = privateKeyWrapper('//Alice');65 alice = privateKeyWrapper('//Alice');6667 55 });68 });56 });69 });577058 it('Creates a new RMRK collection that is mapped to a different ID and is tagged as external', async () => {71 it_rmrk('Creates a new RMRK collection that is mapped to a different ID and is tagged as external', async () => {59 await usingApi(async api => {72 await usingApi(async api => {60 // throwaway collection to bump last Unique collection ID to test ID mapping73 // throwaway collection to bump last Unique collection ID to test ID mapping61 await createCollectionExpectSuccess();74 await createCollectionExpectSuccess();70 });83 });71});84});728573describe('Negative Integration Test: External Collections, Internal Ops', () => {86describe('Negative Integration Test: External Collections, Internal Ops', async () => {74 let uniqueCollectionId: number;87 let uniqueCollectionId: number;75 let rmrkCollectionId: number;88 let rmrkCollectionId: number;76 let rmrkNftId: number;89 let rmrkNftId: number;9091 let it_rmrk = (await isUnique() ? it : it.skip);779278 before(async () => {93 before(async () => {79 await usingApi(async (api, privateKeyWrapper) => {94 await usingApi(async (api, privateKeyWrapper) => {88 });103 });89 });104 });9010591 it('[Negative] Forbids Unique operations with an external collection, handled by dispatch_call', async () => {106 it_rmrk('[Negative] Forbids Unique operations with an external collection, handled by dispatch_call', async () => {92 await usingApi(async api => {107 await usingApi(async api => {93 // Collection item creation108 // Collection item creation94109147 });162 });148 });163 });149164150 it('[Negative] Forbids Unique collection operations with an external collection', async () => {165 it_rmrk('[Negative] Forbids Unique collection operations with an external collection', async () => {151 await usingApi(async api => {166 await usingApi(async api => {152 const txDestroyCollection = api.tx.unique.destroyCollection(uniqueCollectionId);167 const txDestroyCollection = api.tx.unique.destroyCollection(uniqueCollectionId);153 await expect(executeTransaction(api, alice, txDestroyCollection), 'destroying collection')168 await expect(executeTransaction(api, alice, txDestroyCollection), 'destroying collection')206 });221 });207});222});208223209describe('Negative Integration Test: Internal Collections, External Ops', () => {224describe('Negative Integration Test: Internal Collections, External Ops', async () => {210 let collectionId: number;225 let collectionId: number;211 let nftId: number;226 let nftId: number;227228 let it_rmrk = (await isUnique() ? it : it.skip);212229213 before(async () => {230 before(async () => {214 await usingApi(async (api, privateKeyWrapper) => {231 await usingApi(async (api, privateKeyWrapper) => {220 });237 });221 });238 });222239223 it('[Negative] Forbids RMRK operations with the internal collection and NFT (due to the lack of mapping)', async () => {240 it_rmrk('[Negative] Forbids RMRK operations with the internal collection and NFT (due to the lack of mapping)', async () => {224 await usingApi(async api => {241 await usingApi(async api => {225 const txChangeOwner = api.tx.rmrkCore.changeCollectionIssuer(collectionId, bob.address);242 const txChangeOwner = api.tx.rmrkCore.changeCollectionIssuer(collectionId, bob.address);226 await expect(executeTransaction(api, alice, txChangeOwner), 'changing collection issuer')243 await expect(executeTransaction(api, alice, txChangeOwner), 'changing collection issuer')