123456import {ApiPromise} from '@polkadot/api';7import {expect} from 'chai';8import usingApi from './substrate/substrate-api';910function getModuleNames(api: ApiPromise): string[] {11 return api.runtimeMetadata.asLatest.pallets.map(m => m.name.toString().toLowerCase());12}131415const requiredPallets = [16 'balances',17 'common',18 'randomnesscollectiveflip',19 'timestamp',20 'transactionpayment',21 'treasury',22 'system',23 'vesting',24 'parachainsystem',25 'parachaininfo',26 'evm',27 'evmcodersubstrate',28 'evmcontracthelpers',29 'evmmigration',30 'evmtransactionpayment',31 'ethereum',32 'fungible',33 'xcmpqueue',34 'polkadotxcm',35 'cumulusxcm',36 'dmpqueue',37 'inflation',38 'unique',39 'nonfungible',40 'refungible',41 42 'charging',43];444546const consensusPallets = [47 'sudo',48 'aura',49 'auraext',50];5152describe('Pallet presence', () => {53 it('Required pallets are present', async () => {54 await usingApi(async api => {55 for (let i=0; i<requiredPallets.length; i++) {56 expect(getModuleNames(api)).to.include(requiredPallets[i]);57 }58 });59 });60 it('Governance and consensus pallets are present', async () => {61 await usingApi(async api => {62 for (let i=0; i<consensusPallets.length; i++) {63 expect(getModuleNames(api)).to.include(consensusPallets[i]);64 }65 });66 });67 it('No extra pallets are included', async () => {68 await usingApi(async api => {69 expect(getModuleNames(api).sort()).to.be.deep.equal([...requiredPallets, ...consensusPallets].sort());70 });71 });72});