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 'nft',39 'nonfungible',40 'refungible',41 'scheduler',42 'nftpayment',43 'charging',44];454647const consensusPallets = [48 'sudo',49 'aura',50 'auraext',51];5253describe('Pallet presence', () => {54 it('Required pallets are present', async () => {55 await usingApi(async api => {56 for (let i=0; i<requiredPallets.length; i++) {57 expect(getModuleNames(api)).to.include(requiredPallets[i]);58 }59 });60 });61 it('Governance and consensus pallets are present', async () => {62 await usingApi(async api => {63 for (let i=0; i<consensusPallets.length; i++) {64 expect(getModuleNames(api)).to.include(consensusPallets[i]);65 }66 });67 });68 it('No extra pallets are included', async () => {69 await usingApi(async api => {70 expect(getModuleNames(api).sort()).to.be.deep.equal([...requiredPallets, ...consensusPallets].sort());71 });72 });73});