git.delta.rocks / unique-network / refs/commits / 1ecd8fcd29d7

difftreelog

source

tests/src/pallet-presence.test.ts3.1 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 './util';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  '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  'tokens',50  'xtokens',51  'maintenance',52];5354// Pallets that depend on consensus and governance configuration55const consensusPallets = [56  'sudo',57  'aura',58  'auraext',59];6061describe('Pallet presence', () => {62  before(async () => {63    await usingPlaygrounds(async helper => {64      const chain = await helper.callRpc('api.rpc.system.chain', []);6566      const refungible = 'refungible';67      const foreignAssets = 'foreignassets';68      const appPromotion = 'apppromotion';69      const collatorSelection = ['authorship', 'session', 'collatorselection', 'identity'];70      const preimage = ['preimage'];71      const testUtils = 'testutils';7273      if(chain.eq('OPAL by UNIQUE')) {74        requiredPallets.push(75          refungible,76          foreignAssets,77          appPromotion,78          testUtils,79          ...collatorSelection,80          ...preimage,81        );82      } else if(chain.eq('QUARTZ by UNIQUE') || chain.eq('SAPPHIRE by UNIQUE')) {83        requiredPallets.push(84          refungible,85          appPromotion,86          foreignAssets,87          ...collatorSelection,88          ...preimage,89        );90      } else if(chain.eq('UNIQUE')) {91        // Insert Unique additional pallets here92        requiredPallets.push(93          refungible,94          foreignAssets,95          appPromotion,96        );97      }98    });99  });100101  itSub('Required pallets are present', ({helper}) => {102    expect(helper.fetchAllPalletNames()).to.contain.members([...requiredPallets].sort());103  });104105  itSub('Governance and consensus pallets are present', ({helper}) => {106    expect(helper.fetchAllPalletNames()).to.contain.members([...consensusPallets].sort());107  });108109  itSub('No extra pallets are included', ({helper}) => {110    expect(helper.fetchAllPalletNames().sort()).to.be.deep.equal([...requiredPallets, ...consensusPallets].sort());111  });112});