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 'randomnesscollectiveflip',18 'timestamp',19 'transactionpayment',20 'treasury',21 'system',22 'vesting',23 'parachainsystem',24 'parachaininfo',25 'evm',26 'evmcodersubstrate',27 'evmcontracthelpers',28 'evmmigration',29 'evmtransactionpayment',30 'ethereum',31 'xcmpqueue',32 'polkadotxcm',33 'cumulusxcm',34 'dmpqueue',35 'inflation',36 'nft',37 'scheduler',38 'nftpayment',39 'charging',40];414243const consensusPallets = [44 'sudo',45 'aura',46 'auraext',47];4849describe('Pallet presence', () => {50 it('Required pallets are present', async () => {51 await usingApi(async api => {52 for (let i=0; i<requiredPallets.length; i++) {53 expect(getModuleNames(api)).to.include(requiredPallets[i]);54 }55 });56 });57 it('Governance and consensus pallets are present', async () => {58 await usingApi(async api => {59 for (let i=0; i<consensusPallets.length; i++) {60 expect(getModuleNames(api)).to.include(consensusPallets[i]);61 }62 });63 });64 it('No extra pallets are included', async () => {65 await usingApi(async api => {66 expect(getModuleNames(api).sort()).to.be.deep.equal([...requiredPallets, ...consensusPallets].sort());67 });68 });69});