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.modules.map(m => m.name.toString().toLowerCase());12}131415const requiredPallets = [16 'nft', 'inflation', 'balances', 'contracts', 'randomnesscollectiveflip', 'system', 'timestamp', 'transactionpayment', 'treasury', 'vesting', 'nft', 'ethereum'17];181920const consensusPallets = [21 'sudo', 'grandpa', 'aura'22];2324describe('Pallet presence', () => {25 it('Required pallets are present', async () => {26 await usingApi(async api => {27 for (let i=0; i<requiredPallets.length; i++) {28 expect(getModuleNames(api)).to.include(requiredPallets[i]);29 }30 });31 });32 it('Governance and consensus pallets are present', async () => {33 await usingApi(async api => {34 for (let i=0; i<consensusPallets.length; i++) {35 expect(getModuleNames(api)).to.include(consensusPallets[i]);36 }37 });38 });39 it('No extra pallets are included', async () => {40 await usingApi(async api => {41 expect(getModuleNames(api).length).to.be.equal(requiredPallets.length + consensusPallets.length);42 });43 });44});