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