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

difftreelog

source

tests/src/pallet-presence.test.ts2.6 KiBsourcehistory
1// Copyright 2019-2022 Unique Network (Gibraltar) Ltd.2// This file is part of Unique Network.34// Unique Network is free software: you can redistribute it and/or modify5// it under the terms of the GNU General Public License as published by6// the Free Software Foundation, either version 3 of the License, or7// (at your option) any later version.89// Unique Network is distributed in the hope that it will be useful,10// but WITHOUT ANY WARRANTY; without even the implied warranty of11// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the12// GNU General Public License for more details.1314// You should have received a copy of the GNU General Public License15// along with Unique Network. If not, see <http://www.gnu.org/licenses/>.1617import {expect} from 'chai';18import {itSub, usingPlaygrounds} from './util/playgrounds';1920// Pallets that must always be present21const requiredPallets = [22  'balances',23  'common',24  'randomnesscollectiveflip',25  'timestamp',26  'transactionpayment',27  'treasury',28  'structure',29  'system',30  'vesting',31  'parachainsystem',32  'parachaininfo',33  'evm',34  'evmcodersubstrate',35  'evmcontracthelpers',36  'evmmigration',37  'evmtransactionpayment',38  'ethereum',39  'fungible',40  'xcmpqueue',41  'polkadotxcm',42  'cumulusxcm',43  'dmpqueue',44  'inflation',45  'unique',46  'nonfungible',47  'charging',48  'configuration',49];5051// Pallets that depend on consensus and governance configuration52const consensusPallets = [53  'sudo',54  'aura',55  'auraext',56];5758describe('Pallet presence', () => {59  before(async () => {60    await usingPlaygrounds(async helper => {61      const chain = await helper.api!.rpc.system.chain();6263      const refungible = 'refungible';64      const scheduler = 'scheduler';65      const rmrkPallets = ['rmrkcore', 'rmrkequip'];66      const appPromotion = 'apppromotion';6768      if (chain.eq('OPAL by UNIQUE')) {69        requiredPallets.push(refungible, scheduler, appPromotion, ...rmrkPallets);70      } else if (chain.eq('QUARTZ by UNIQUE')) {71        // Insert Quartz additional pallets here72      } else if (chain.eq('UNIQUE')) {73        // Insert Unique additional pallets here74      }75    });76  });7778  itSub('Required pallets are present', async ({helper}) => {79    expect(helper.fetchAllPalletNames()).to.contain.members([...requiredPallets]);80  });8182  itSub('Governance and consensus pallets are present', async ({helper}) => {83    expect(helper.fetchAllPalletNames()).to.contain.members([...consensusPallets]);84  });8586  itSub('No extra pallets are included', async ({helper}) => {87    expect(helper.fetchAllPalletNames().sort()).to.be.deep.equal([...requiredPallets, ...consensusPallets].sort());88  });89});