git.delta.rocks / unique-network / refs/commits / 5af2b45e48fe

difftreelog

Tests cleanup

Greg Zaitsev2021-07-14parent: #2fc9e2d.patch.diff
in: master

3 files changed

modifiedtests/src/pallet-presence.test.tsdiffbeforeafterboth
before · tests/src/pallet-presence.test.ts
1//2// This file is subject to the terms and conditions defined in3// file 'LICENSE', which is part of this source code package.4//56import { ApiPromise } from '@polkadot/api';7import { expect } from 'chai';8import usingApi from './substrate/substrate-api';910function getModuleNames(api: ApiPromise): string[] {11  return api.runtimeMetadata.asLatest.modules.map(m => m.name.toString().toLowerCase());12}1314// Pallets that must always be present15const requiredPallets = [16  'balances',17  'randomnesscollectiveflip',18  'timestamp',19  'transactionpayment',20  'treasury',21  'system',22  'vesting',23  'parachainsystem',24  'parachaininfo',25  'evm',26  'ethereum',27  'xcmpqueue',28  'polkadotxcm',29  'cumulusxcm',30  'dmpqueue',31  'inflation',32  'nft',33  'scheduler',34  'nftpayment',35  'charging'36];3738// Pallets that depend on consensus and governance configuration39const consensusPallets = [40  'sudo',41  'aura',42  'auraext'43];4445describe.only('Pallet presence', () => {46  it('Required pallets are present', async () => {47    await usingApi(async api => {48      for (let i=0; i<requiredPallets.length; i++) {49        expect(getModuleNames(api)).to.include(requiredPallets[i]);50      }51    });52  });53  it('Governance and consensus pallets are present', async () => {54    await usingApi(async api => {55      for (let i=0; i<consensusPallets.length; i++) {56        expect(getModuleNames(api)).to.include(consensusPallets[i]);57      }58    });59  });60  it('No extra pallets are included', async () => {61    await usingApi(async api => {62      expect(getModuleNames(api).length).to.be.equal(requiredPallets.length + consensusPallets.length);63    });64  });65});
after · tests/src/pallet-presence.test.ts
1//2// This file is subject to the terms and conditions defined in3// file 'LICENSE', which is part of this source code package.4//56import { ApiPromise } from '@polkadot/api';7import { expect } from 'chai';8import usingApi from './substrate/substrate-api';910function getModuleNames(api: ApiPromise): string[] {11  return api.runtimeMetadata.asLatest.modules.map(m => m.name.toString().toLowerCase());12}1314// Pallets that must always be present15const requiredPallets = [16  'balances',17  'randomnesscollectiveflip',18  'timestamp',19  'transactionpayment',20  'treasury',21  'system',22  'vesting',23  'parachainsystem',24  'parachaininfo',25  'evm',26  'ethereum',27  'xcmpqueue',28  'polkadotxcm',29  'cumulusxcm',30  'dmpqueue',31  'inflation',32  'nft',33  'scheduler',34  'nftpayment',35  'charging'36];3738// Pallets that depend on consensus and governance configuration39const consensusPallets = [40  'sudo',41  'aura',42  'auraext'43];4445describe('Pallet presence', () => {46  it('Required pallets are present', async () => {47    await usingApi(async api => {48      for (let i=0; i<requiredPallets.length; i++) {49        expect(getModuleNames(api)).to.include(requiredPallets[i]);50      }51    });52  });53  it('Governance and consensus pallets are present', async () => {54    await usingApi(async api => {55      for (let i=0; i<consensusPallets.length; i++) {56        expect(getModuleNames(api)).to.include(consensusPallets[i]);57      }58    });59  });60  it('No extra pallets are included', async () => {61    await usingApi(async api => {62      expect(getModuleNames(api).length).to.be.equal(requiredPallets.length + consensusPallets.length);63    });64  });65});
modifiedtests/src/removeCollectionAdmin.test.tsdiffbeforeafterboth
--- a/tests/src/removeCollectionAdmin.test.ts
+++ b/tests/src/removeCollectionAdmin.test.ts
@@ -20,7 +20,7 @@
       const Alice = privateKey('//Alice');
       const Bob = privateKey('//Bob');
       const collection: any = (await api.query.nft.collectionById(collectionId)).toJSON();
-      expect(collection.Owner).to.be.deep.eq(normalizeAccountId(Alice.address));
+      expect(collection.Owner).to.be.deep.eq(Alice.address);
       // first - add collection admin Bob
       const addAdminTx = api.tx.nft.addCollectionAdmin(collectionId, normalizeAccountId(Bob.address));
       await submitTransactionAsync(Alice, addAdminTx);
modifiedtests/src/removeCollectionSponsor.test.tsdiffbeforeafterboth
--- a/tests/src/removeCollectionSponsor.test.ts
+++ b/tests/src/removeCollectionSponsor.test.ts
@@ -28,7 +28,7 @@
 let alice: IKeyringPair;
 let bob: IKeyringPair;
 
-describe('integration test: ext. removeCollectionSponsor():', () => {
+describe.only('integration test: ext. removeCollectionSponsor():', () => {
 
   before(async () => {
     await usingApi(async () => {
@@ -38,7 +38,7 @@
     });
   });
 
-  it('Remove NFT collection sponsor stops sponsorship', async () => {
+  it('Removing NFT collection sponsor stops sponsorship', async () => {
     const collectionId = await createCollectionExpectSuccess();
     await setCollectionSponsorExpectSuccess(collectionId, bob.address);
     await confirmSponsorshipExpectSuccess(collectionId, '//Bob');
@@ -85,7 +85,7 @@
 
 });
 
-describe('(!negative test!) integration test: ext. removeCollectionSponsor():', () => {
+describe.only('(!negative test!) integration test: ext. removeCollectionSponsor():', () => {
   before(async () => {
     await usingApi(async () => {
       const keyring = new Keyring({ type: 'sr25519' });