1234567891011121314151617import {ApiPromise} from '@polkadot/api';18import {expect} from 'chai';19import usingApi from './substrate/substrate-api';2021function getModuleNames(api: ApiPromise): string[] {22 return api.runtimeMetadata.asLatest.pallets.map(m => m.name.toString().toLowerCase());23}242526const requiredPallets = [27 'balances',28 'common',29 'randomnesscollectiveflip',30 'timestamp',31 'transactionpayment',32 'treasury',33 'system',34 'vesting',35 'parachainsystem',36 'parachaininfo',37 'evm',38 'evmcodersubstrate',39 'evmcontracthelpers',40 'evmmigration',41 'evmtransactionpayment',42 'ethereum',43 'fungible',44 'xcmpqueue',45 'polkadotxcm',46 'cumulusxcm',47 'dmpqueue',48 'inflation',49 'unique',50 'nonfungible',51 'refungible',52 53 'charging',54];555657const consensusPallets = [58 'sudo',59 'aura',60 'auraext',61];6263describe('Pallet presence', () => {64 it('Required pallets are present', async () => {65 await usingApi(async api => {66 for (let i=0; i<requiredPallets.length; i++) {67 expect(getModuleNames(api)).to.include(requiredPallets[i]);68 }69 });70 });71 it('Governance and consensus pallets are present', async () => {72 await usingApi(async api => {73 for (let i=0; i<consensusPallets.length; i++) {74 expect(getModuleNames(api)).to.include(consensusPallets[i]);75 }76 });77 });78 it('No extra pallets are included', async () => {79 await usingApi(async api => {80 expect(getModuleNames(api).sort()).to.be.deep.equal([...requiredPallets, ...consensusPallets].sort());81 });82 });83});