git.delta.rocks / unique-network / refs/commits / ad2fb5492655

difftreelog

source

tests/src/pallet-presence.test.ts1.5 KiBsourcehistory
1//2// This file is subject to the terms and conditions defined in3// file 'LICENSE', which is part of this source code package.4//56import { 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}1314// Pallets that must always be present15const requiredPallets = [16  'nft', 'inflation', 'balances', 'contracts', 'randomnesscollectiveflip', 'system', 'timestamp', 'transactionpayment', 'treasury', 'vesting', 'evm', 'ethereum',17  'scheduler', 'nftpayment', 'charging',18];1920// Pallets that depend on consensus and governance configuration21const consensusPallets = [22  'sudo', 'aura',23];2425describe('Pallet presence', () => {26  it('Required pallets are present', async () => {27    await usingApi(async api => {28      for (let i=0; i<requiredPallets.length; i++) {29        expect(getModuleNames(api)).to.include(requiredPallets[i]);30      }31    });32  });33  it('Governance and consensus pallets are present', async () => {34    await usingApi(async api => {35      for (let i=0; i<consensusPallets.length; i++) {36        expect(getModuleNames(api)).to.include(consensusPallets[i]);37      }38    });39  });40  it('No extra pallets are included', async () => {41    await usingApi(async api => {42      expect(getModuleNames(api).length).to.be.equal(requiredPallets.length + consensusPallets.length);43    });44  });45});