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
11} 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';
1415
15let alice: IKeyringPair;16let alice: IKeyringPair;
16let bob: IKeyringPair;17let bob: IKeyringPair;
48 return result.data!;49 return result.data!;
49}50}
51
52async function isUnique(): Promise<boolean> {
53 return usingApi(async api => {
54 const chain = await api.rpc.system.chain();
55
56 return chain.eq('UNIQUE')
57 })
58}
5059
51describe('RMRK External Integration Test', () => {60describe('RMRK External Integration Test', async () => {
61 let it_rmrk = (await isUnique() ? it : it.skip);
62
52 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');
66
67
55 });68 });
56 });69 });
5770
58 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 mapping
61 await createCollectionExpectSuccess();74 await createCollectionExpectSuccess();
70 });83 });
71});84});
7285
73describe('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;
90
91 let it_rmrk = (await isUnique() ? it : it.skip);
7792
78 before(async () => {93 before(async () => {
79 await usingApi(async (api, privateKeyWrapper) => {94 await usingApi(async (api, privateKeyWrapper) => {
88 });103 });
89 });104 });
90105
91 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 creation
94109
147 });162 });
148 });163 });
149164
150 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});
208223
209describe('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;
227
228 let it_rmrk = (await isUnique() ? it : it.skip);
212229
213 before(async () => {230 before(async () => {
214 await usingApi(async (api, privateKeyWrapper) => {231 await usingApi(async (api, privateKeyWrapper) => {
220 });237 });
221 });238 });
222239
223 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')