difftreelog
fix tests style
in: master
2 files changed
tests/src/pallet-presence.test.tsdiffbeforeafterboth1// 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 {ApiPromise} from '@polkadot/api';18import {expect} from 'chai';19import usingApi from './substrate/substrate-api';2021function getModuleNames(api: ApiPromise): string[] {22 return api.runtimeMetadata.asLatest.pallets.map(m => m.name.toString().toLowerCase());23}2425// Pallets that must always be present26let requiredPallets = [27 'balances',28 'common',29 'randomnesscollectiveflip',30 'timestamp',31 'transactionpayment',32 'treasury',33 'structure',34 'system',35 'vesting',36 'parachainsystem',37 'parachaininfo',38 'evm',39 'evmcodersubstrate',40 'evmcontracthelpers',41 'evmmigration',42 'evmtransactionpayment',43 'ethereum',44 'fungible',45 'xcmpqueue',46 'polkadotxcm',47 'cumulusxcm',48 'dmpqueue',49 'inflation',50 'unique',51 'nonfungible',52 'refungible',53 'scheduler',54 'charging',55];5657// Pallets that depend on consensus and governance configuration58const consensusPallets = [59 'sudo',60 'aura',61 'auraext',62];6364describe('Pallet presence', () => {65 before(async () => {66 await usingApi(async api => {67 const chain = await api.rpc.system.chain();6869 if (!chain.eq('UNIQUE')) {70 requiredPallets.push(...['rmrkcore', 'rmrkequip']);71 }72 });73 });7475 it('Required pallets are present', async () => {76 await usingApi(async api => {77 for (let i=0; i<requiredPallets.length; i++) {78 expect(getModuleNames(api)).to.include(requiredPallets[i]);79 }80 });81 });82 it('Governance and consensus pallets are present', async () => {83 await usingApi(async api => {84 for (let i=0; i<consensusPallets.length; i++) {85 expect(getModuleNames(api)).to.include(consensusPallets[i]);86 }87 });88 });89 it('No extra pallets are included', async () => {90 await usingApi(async api => {91 expect(getModuleNames(api).sort()).to.be.deep.equal([...requiredPallets, ...consensusPallets].sort());92 });93 });94});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 {ApiPromise} from '@polkadot/api';18import {expect} from 'chai';19import usingApi from './substrate/substrate-api';2021function getModuleNames(api: ApiPromise): string[] {22 return api.runtimeMetadata.asLatest.pallets.map(m => m.name.toString().toLowerCase());23}2425// Pallets that must always be present26const requiredPallets = [27 'balances',28 'common',29 'randomnesscollectiveflip',30 'timestamp',31 'transactionpayment',32 'treasury',33 'structure',34 'system',35 'vesting',36 'parachainsystem',37 'parachaininfo',38 'evm',39 'evmcodersubstrate',40 'evmcontracthelpers',41 'evmmigration',42 'evmtransactionpayment',43 'ethereum',44 'fungible',45 'xcmpqueue',46 'polkadotxcm',47 'cumulusxcm',48 'dmpqueue',49 'inflation',50 'unique',51 'nonfungible',52 'refungible',53 'scheduler',54 'charging',55];5657// Pallets that depend on consensus and governance configuration58const consensusPallets = [59 'sudo',60 'aura',61 'auraext',62];6364describe('Pallet presence', () => {65 before(async () => {66 await usingApi(async api => {67 const chain = await api.rpc.system.chain();6869 if (!chain.eq('UNIQUE')) {70 requiredPallets.push(...['rmrkcore', 'rmrkequip']);71 }72 });73 });7475 it('Required pallets are present', async () => {76 await usingApi(async api => {77 for (let i=0; i<requiredPallets.length; i++) {78 expect(getModuleNames(api)).to.include(requiredPallets[i]);79 }80 });81 });82 it('Governance and consensus pallets are present', async () => {83 await usingApi(async api => {84 for (let i=0; i<consensusPallets.length; i++) {85 expect(getModuleNames(api)).to.include(consensusPallets[i]);86 }87 });88 });89 it('No extra pallets are included', async () => {90 await usingApi(async api => {91 expect(getModuleNames(api).sort()).to.be.deep.equal([...requiredPallets, ...consensusPallets].sort());92 });93 });94});tests/src/rmrk/rmrk.test.tsdiffbeforeafterboth--- a/tests/src/rmrk/rmrk.test.ts
+++ b/tests/src/rmrk/rmrk.test.ts
@@ -11,7 +11,7 @@
} from '../util/helpers';
import {IKeyringPair} from '@polkadot/types/types';
import {ApiPromise} from '@polkadot/api';
-import { it } from 'mocha';
+import {it} from 'mocha';
let alice: IKeyringPair;
let bob: IKeyringPair;
@@ -53,12 +53,12 @@
return usingApi(async api => {
const chain = await api.rpc.system.chain();
- return chain.eq('UNIQUE')
- })
+ return chain.eq('UNIQUE');
+ });
}
describe('RMRK External Integration Test', async () => {
- let it_rmrk = (await isUnique() ? it : it.skip);
+ const it_rmrk = (await isUnique() ? it : it.skip);
before(async () => {
await usingApi(async (api, privateKeyWrapper) => {
@@ -88,7 +88,7 @@
let rmrkCollectionId: number;
let rmrkNftId: number;
- let it_rmrk = (await isUnique() ? it : it.skip);
+ const it_rmrk = (await isUnique() ? it : it.skip);
before(async () => {
await usingApi(async (api, privateKeyWrapper) => {
@@ -225,7 +225,7 @@
let collectionId: number;
let nftId: number;
- let it_rmrk = (await isUnique() ? it : it.skip);
+ const it_rmrk = (await isUnique() ? it : it.skip);
before(async () => {
await usingApi(async (api, privateKeyWrapper) => {