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

difftreelog

source

js-packages/tests/pallet-presence.test.ts3.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 {itSub, usingPlaygrounds, expect} from '@unique/test-utils/util.js';1819// Pallets that must always be present20const requiredPallets = [21  'balances',22  'balancesadapter',23  'common',24  'timestamp',25  'transactionpayment',26  'treasury',27  'statetriemigration',28  'structure',29  'system',30  'utility',31  'vesting',32  'parachainsystem',33  'parachaininfo',34  'evm',35  'evmcodersubstrate',36  'evmcontracthelpers',37  'evmmigration',38  'evmtransactionpayment',39  'ethereum',40  'fungible',41  'xcmpqueue',42  'polkadotxcm',43  'cumulusxcm',44  'dmpqueue',45  'inflation',46  'unique',47  'nonfungible',48  'charging',49  'configuration',50  'xtokens',51  'maintenance',52  'messagequeue',53];5455// Pallets that depend on consensus and governance configuration56const consensusPallets = [57  'sudo',58  'aura',59  'auraext',60];6162describe('Pallet presence', () => {63  before(async () => {64    await usingPlaygrounds(async helper => {65      const runtimeVersion = await helper.callRpc('api.rpc.state.getRuntimeVersion', []);66      const chain = runtimeVersion.specName;6768      const refungible = 'refungible';69      const foreignAssets = 'foreignassets';70      const appPromotion = 'apppromotion';71      const collatorSelection = ['authorship', 'session', 'collatorselection'];72      const preimage = ['preimage'];73      const governance = [74        'council',75        'councilmembership',76        'democracy',77        'fellowshipcollective',78        'fellowshipreferenda',79        'origins',80        'scheduler',81        'technicalcommittee',82        'technicalcommitteemembership',83        'financialcouncil',84        'financialcouncilmembership',85        'identity',86      ];87      const testUtils = 'testutils';8889      if(chain.eq('opal')) {90        requiredPallets.push(91          refungible,92          foreignAssets,93          appPromotion,94          testUtils,95          ...collatorSelection,96          ...preimage,97          ...governance,98        );99      } else if(chain.eq('quartz') || chain.eq('sapphire')) {100        requiredPallets.push(101          refungible,102          appPromotion,103          foreignAssets,104          ...collatorSelection,105          ...preimage,106          ...governance,107        );108      } else if(chain.eq('unique')) {109        // Insert Unique additional pallets here110        requiredPallets.push(111          refungible,112          foreignAssets,113          appPromotion,114          ...preimage,115          ...governance,116        );117      }118    });119  });120121  itSub('Required pallets are present', ({helper}) => {122    expect(helper.fetchAllPalletNames()).to.contain.members([...requiredPallets].sort());123  });124125  itSub('Governance and consensus pallets are present', ({helper}) => {126    expect(helper.fetchAllPalletNames()).to.contain.members([...consensusPallets].sort());127  });128129  itSub('No extra pallets are included', ({helper}) => {130    expect(helper.fetchAllPalletNames().sort()).to.be.deep.equal([...requiredPallets, ...consensusPallets].sort());131  });132});