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 'structure',34 'system',35 'vesting',36 'parachainsystem',37 'parachaininfo',38 'evm',39 'evmcodersubstrate',40 'evmcontracthelpers',41 'evmmigration',42 'evmtransactionpayment',43 'ethereum',44 'fungible',45 'xcmpqueue',46 'polkadotxcm',47 'cumulusxcm',48 'dmpqueue',49 'inflation',50 'unique',51 'nonfungible',52 'refungible',53 'rmrkcore',54 'rmrkequip',55 'scheduler',56 'charging',57];585960const consensusPallets = [61 'sudo',62 'aura',63 'auraext',64];6566describe('Pallet presence', () => {67 it('Required pallets are present', async () => {68 await usingApi(async api => {69 for (let i=0; i<requiredPallets.length; i++) {70 expect(getModuleNames(api)).to.include(requiredPallets[i]);71 }72 });73 });74 it('Governance and consensus pallets are present', async () => {75 await usingApi(async api => {76 for (let i=0; i<consensusPallets.length; i++) {77 expect(getModuleNames(api)).to.include(consensusPallets[i]);78 }79 });80 });81 it('No extra pallets are included', async () => {82 await usingApi(async api => {83 expect(getModuleNames(api).sort()).to.be.deep.equal([...requiredPallets, ...consensusPallets].sort());84 });85 });86});