difftreelog
test remove .only
in: master
14 files changed
tests/src/benchmarks/utils/common.tsdiffbeforeafterboth--- a/tests/src/benchmarks/utils/common.ts
+++ b/tests/src/benchmarks/utils/common.ts
@@ -91,4 +91,4 @@
await collection.setTokenPropertyPermissions(donor, permissions);
return collection;
-}
\ No newline at end of file
+}
tests/src/creditFeesToTreasury.seqtest.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 './interfaces/augment-api-consts';18import {IKeyringPair} from '@polkadot/types/types';19import {ApiPromise} from '@polkadot/api';20import {usingPlaygrounds, expect, itSub} from './util';2122const TREASURY = '5EYCAe5ijiYfyeZ2JJCGq56LmPyNRAKzpG4QkoQkkQNB5e6Z';23const saneMinimumFee = 0.05;24const saneMaximumFee = 0.5;25const createCollectionDeposit = 100;2627// Skip the inflation block pauses if the block is close to inflation block28// until the inflation happens29/*eslint no-async-promise-executor: "off"*/30function skipInflationBlock(api: ApiPromise): Promise<void> {31 const promise = new Promise<void>(async (resolve) => {32 const blockInterval = api.consts.inflation.inflationBlockInterval.toNumber();33 const unsubscribe = await api.rpc.chain.subscribeNewHeads(head => {34 const currentBlock = head.number.toNumber();35 if (currentBlock % blockInterval < blockInterval - 10) {36 unsubscribe();37 resolve();38 } else {39 console.log(`Skipping inflation block, current block: ${currentBlock}`);40 }41 });42 });4344 return promise;45}4647describe('integration test: Fees must be credited to Treasury:', () => {48 let alice: IKeyringPair;49 let bob: IKeyringPair;5051 before(async () => {52 await usingPlaygrounds(async (helper, privateKey) => {53 const donor = await privateKey({url: import.meta.url});54 [alice, bob] = await helper.arrange.createAccounts([100n, 100n], donor);55 });56 });5758 itSub('Total issuance does not change', async ({helper}) => {59 const api = helper.getApi();60 await skipInflationBlock(api);61 await helper.wait.newBlocks(1);6263 const totalBefore = (await helper.callRpc('api.query.balances.totalIssuance', [])).toBigInt();6465 await helper.balance.transferToSubstrate(alice, bob.address, 1n);6667 const totalAfter = (await helper.callRpc('api.query.balances.totalIssuance', [])).toBigInt();6869 expect(totalAfter).to.be.equal(totalBefore);70 });7172 itSub('Sender balance decreased by fee+sent amount, Treasury balance increased by fee', async ({helper}) => {73 await skipInflationBlock(helper.getApi());74 await helper.wait.newBlocks(1);7576 const treasuryBalanceBefore = await helper.balance.getSubstrate(TREASURY);77 const aliceBalanceBefore = await helper.balance.getSubstrate(alice.address);7879 const amount = 1n;80 await helper.balance.transferToSubstrate(alice, bob.address, amount);8182 const treasuryBalanceAfter = await helper.balance.getSubstrate(TREASURY);83 const aliceBalanceAfter = await helper.balance.getSubstrate(alice.address);8485 const fee = aliceBalanceBefore - aliceBalanceAfter - amount;86 const treasuryIncrease = treasuryBalanceAfter - treasuryBalanceBefore;8788 expect(treasuryIncrease).to.be.equal(fee);89 });9091 itSub.only('Treasury balance increased by failed tx fee', async ({helper}) => {92 const api = helper.getApi();93 await helper.wait.newBlocks(1);9495 const treasuryBalanceBefore = await helper.balance.getSubstrate(TREASURY);96 const bobBalanceBefore = await helper.balance.getSubstrate(bob.address);9798 await expect(helper.signTransaction(bob, api.tx.balances.forceSetBalance(alice.address, 0))).to.be.rejected;99100 const treasuryBalanceAfter = await helper.balance.getSubstrate(TREASURY);101 const bobBalanceAfter = await helper.balance.getSubstrate(bob.address);102103 const fee = bobBalanceBefore - bobBalanceAfter;104 const treasuryIncrease = treasuryBalanceAfter - treasuryBalanceBefore;105106 expect(treasuryIncrease).to.be.equal(fee);107 });108109 itSub('NFT Transactions also send fees to Treasury', async ({helper}) => {110 await skipInflationBlock(helper.getApi());111 await helper.wait.newBlocks(1);112113 const treasuryBalanceBefore = await helper.balance.getSubstrate(TREASURY);114 const aliceBalanceBefore = await helper.balance.getSubstrate(alice.address);115116 await helper.nft.mintCollection(alice, {name: 'test', description: 'test', tokenPrefix: 'test'});117118 const treasuryBalanceAfter = await helper.balance.getSubstrate(TREASURY);119 const aliceBalanceAfter = await helper.balance.getSubstrate(alice.address);120 const fee = aliceBalanceBefore - aliceBalanceAfter;121 const treasuryIncrease = treasuryBalanceAfter - treasuryBalanceBefore;122123 expect(treasuryIncrease).to.be.equal(fee);124 });125126 itSub('Fees are sane', async ({helper}) => {127 const unique = helper.balance.getOneTokenNominal();128 await skipInflationBlock(helper.getApi());129 await helper.wait.newBlocks(1);130131 const aliceBalanceBefore = await helper.balance.getSubstrate(alice.address);132133 await helper.nft.mintCollection(alice, {name: 'test', description: 'test', tokenPrefix: 'test'});134135 const aliceBalanceAfter = await helper.balance.getSubstrate(alice.address);136 const fee = aliceBalanceBefore - aliceBalanceAfter;137138 expect(fee / unique < BigInt(Math.ceil(saneMaximumFee + createCollectionDeposit))).to.be.true;139 expect(fee / unique < BigInt(Math.ceil(saneMinimumFee + createCollectionDeposit))).to.be.true;140 });141142 itSub('NFT Transfer fee is close to 0.1 Unique', async ({helper}) => {143 await skipInflationBlock(helper.getApi());144 await helper.wait.newBlocks(1);145146 const collection = await helper.nft.mintCollection(alice, {147 name: 'test',148 description: 'test',149 tokenPrefix: 'test',150 });151 // const tokenId = await createItemExpectSuccess(alice, collectionId, 'NFT');152 const token = await collection.mintToken(alice, {Substrate: alice.address});153154 const aliceBalanceBefore = await helper.balance.getSubstrate(alice.address);155 await token.transfer(alice, {Substrate: bob.address});156 const aliceBalanceAfter = await helper.balance.getSubstrate(alice.address);157158 const fee = Number(aliceBalanceBefore - aliceBalanceAfter) / Number(helper.balance.getOneTokenNominal());159 const expectedTransferFee = 0.1;160 // fee drifts because of NextFeeMultiplier161 const tolerance = 0.001;162163 expect(Math.abs(fee - expectedTransferFee)).to.be.lessThan(tolerance);164 });165});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 './interfaces/augment-api-consts';18import {IKeyringPair} from '@polkadot/types/types';19import {ApiPromise} from '@polkadot/api';20import {usingPlaygrounds, expect, itSub} from './util';2122const TREASURY = '5EYCAe5ijiYfyeZ2JJCGq56LmPyNRAKzpG4QkoQkkQNB5e6Z';23const saneMinimumFee = 0.05;24const saneMaximumFee = 0.5;25const createCollectionDeposit = 100;2627// Skip the inflation block pauses if the block is close to inflation block28// until the inflation happens29/*eslint no-async-promise-executor: "off"*/30function skipInflationBlock(api: ApiPromise): Promise<void> {31 const promise = new Promise<void>(async (resolve) => {32 const blockInterval = api.consts.inflation.inflationBlockInterval.toNumber();33 const unsubscribe = await api.rpc.chain.subscribeNewHeads(head => {34 const currentBlock = head.number.toNumber();35 if (currentBlock % blockInterval < blockInterval - 10) {36 unsubscribe();37 resolve();38 } else {39 console.log(`Skipping inflation block, current block: ${currentBlock}`);40 }41 });42 });4344 return promise;45}4647describe('integration test: Fees must be credited to Treasury:', () => {48 let alice: IKeyringPair;49 let bob: IKeyringPair;5051 before(async () => {52 await usingPlaygrounds(async (helper, privateKey) => {53 const donor = await privateKey({url: import.meta.url});54 [alice, bob] = await helper.arrange.createAccounts([100n, 100n], donor);55 });56 });5758 itSub('Total issuance does not change', async ({helper}) => {59 const api = helper.getApi();60 await skipInflationBlock(api);61 await helper.wait.newBlocks(1);6263 const totalBefore = (await helper.callRpc('api.query.balances.totalIssuance', [])).toBigInt();6465 await helper.balance.transferToSubstrate(alice, bob.address, 1n);6667 const totalAfter = (await helper.callRpc('api.query.balances.totalIssuance', [])).toBigInt();6869 expect(totalAfter).to.be.equal(totalBefore);70 });7172 itSub('Sender balance decreased by fee+sent amount, Treasury balance increased by fee', async ({helper}) => {73 await skipInflationBlock(helper.getApi());74 await helper.wait.newBlocks(1);7576 const treasuryBalanceBefore = await helper.balance.getSubstrate(TREASURY);77 const aliceBalanceBefore = await helper.balance.getSubstrate(alice.address);7879 const amount = 1n;80 await helper.balance.transferToSubstrate(alice, bob.address, amount);8182 const treasuryBalanceAfter = await helper.balance.getSubstrate(TREASURY);83 const aliceBalanceAfter = await helper.balance.getSubstrate(alice.address);8485 const fee = aliceBalanceBefore - aliceBalanceAfter - amount;86 const treasuryIncrease = treasuryBalanceAfter - treasuryBalanceBefore;8788 expect(treasuryIncrease).to.be.equal(fee);89 });9091 itSub('Treasury balance increased by failed tx fee', async ({helper}) => {92 const api = helper.getApi();93 await helper.wait.newBlocks(1);9495 const treasuryBalanceBefore = await helper.balance.getSubstrate(TREASURY);96 const bobBalanceBefore = await helper.balance.getSubstrate(bob.address);9798 await expect(helper.signTransaction(bob, api.tx.balances.forceSetBalance(alice.address, 0))).to.be.rejected;99100 const treasuryBalanceAfter = await helper.balance.getSubstrate(TREASURY);101 const bobBalanceAfter = await helper.balance.getSubstrate(bob.address);102103 const fee = bobBalanceBefore - bobBalanceAfter;104 const treasuryIncrease = treasuryBalanceAfter - treasuryBalanceBefore;105106 expect(treasuryIncrease).to.be.equal(fee);107 });108109 itSub('NFT Transactions also send fees to Treasury', async ({helper}) => {110 await skipInflationBlock(helper.getApi());111 await helper.wait.newBlocks(1);112113 const treasuryBalanceBefore = await helper.balance.getSubstrate(TREASURY);114 const aliceBalanceBefore = await helper.balance.getSubstrate(alice.address);115116 await helper.nft.mintCollection(alice, {name: 'test', description: 'test', tokenPrefix: 'test'});117118 const treasuryBalanceAfter = await helper.balance.getSubstrate(TREASURY);119 const aliceBalanceAfter = await helper.balance.getSubstrate(alice.address);120 const fee = aliceBalanceBefore - aliceBalanceAfter;121 const treasuryIncrease = treasuryBalanceAfter - treasuryBalanceBefore;122123 expect(treasuryIncrease).to.be.equal(fee);124 });125126 itSub('Fees are sane', async ({helper}) => {127 const unique = helper.balance.getOneTokenNominal();128 await skipInflationBlock(helper.getApi());129 await helper.wait.newBlocks(1);130131 const aliceBalanceBefore = await helper.balance.getSubstrate(alice.address);132133 await helper.nft.mintCollection(alice, {name: 'test', description: 'test', tokenPrefix: 'test'});134135 const aliceBalanceAfter = await helper.balance.getSubstrate(alice.address);136 const fee = aliceBalanceBefore - aliceBalanceAfter;137138 expect(fee / unique < BigInt(Math.ceil(saneMaximumFee + createCollectionDeposit))).to.be.true;139 expect(fee / unique < BigInt(Math.ceil(saneMinimumFee + createCollectionDeposit))).to.be.true;140 });141142 itSub('NFT Transfer fee is close to 0.1 Unique', async ({helper}) => {143 await skipInflationBlock(helper.getApi());144 await helper.wait.newBlocks(1);145146 const collection = await helper.nft.mintCollection(alice, {147 name: 'test',148 description: 'test',149 tokenPrefix: 'test',150 });151 // const tokenId = await createItemExpectSuccess(alice, collectionId, 'NFT');152 const token = await collection.mintToken(alice, {Substrate: alice.address});153154 const aliceBalanceBefore = await helper.balance.getSubstrate(alice.address);155 await token.transfer(alice, {Substrate: bob.address});156 const aliceBalanceAfter = await helper.balance.getSubstrate(alice.address);157158 const fee = Number(aliceBalanceBefore - aliceBalanceAfter) / Number(helper.balance.getOneTokenNominal());159 const expectedTransferFee = 0.1;160 // fee drifts because of NextFeeMultiplier161 const tolerance = 0.001;162163 expect(Math.abs(fee - expectedTransferFee)).to.be.lessThan(tolerance);164 });165});tests/src/eth/collectionSponsoring.test.tsdiffbeforeafterboth--- a/tests/src/eth/collectionSponsoring.test.ts
+++ b/tests/src/eth/collectionSponsoring.test.ts
@@ -18,7 +18,7 @@
import {Pallets, requirePalletsOrSkip, usingPlaygrounds} from '../util/index';
import {itEth, expect} from './util';
-describe.only('evm nft collection sponsoring', () => {
+describe('evm nft collection sponsoring', () => {
let donor: IKeyringPair;
let alice: IKeyringPair;
let nominal: bigint;
@@ -319,7 +319,7 @@
});
});
-describe.only('evm RFT collection sponsoring', () => {
+describe('evm RFT collection sponsoring', () => {
let donor: IKeyringPair;
let alice: IKeyringPair;
let nominal: bigint;
tests/src/eth/createFTCollection.seqtest.tsdiffbeforeafterboth--- a/tests/src/eth/createFTCollection.seqtest.ts
+++ b/tests/src/eth/createFTCollection.seqtest.ts
@@ -20,7 +20,7 @@
const DECIMALS = 18;
-describe.only('Create FT collection from EVM', () => {
+describe('Create FT collection from EVM', () => {
let donor: IKeyringPair;
before(async function() {
tests/src/eth/createFTCollection.test.tsdiffbeforeafterboth--- a/tests/src/eth/createFTCollection.test.ts
+++ b/tests/src/eth/createFTCollection.test.ts
@@ -22,7 +22,7 @@
const DECIMALS = 18;
-describe.only('Create FT collection from EVM', () => {
+describe('Create FT collection from EVM', () => {
let donor: IKeyringPair;
before(async function() {
@@ -129,7 +129,7 @@
});
});
-describe.only('(!negative tests!) Create FT collection from EVM', () => {
+describe('(!negative tests!) Create FT collection from EVM', () => {
let donor: IKeyringPair;
let nominal: bigint;
tests/src/eth/createNFTCollection.test.tsdiffbeforeafterboth--- a/tests/src/eth/createNFTCollection.test.ts
+++ b/tests/src/eth/createNFTCollection.test.ts
@@ -21,7 +21,7 @@
import {COLLECTION_HELPER} from '../util';
-describe.only('Create NFT collection from EVM', () => {
+describe('Create NFT collection from EVM', () => {
let donor: IKeyringPair;
before(async function () {
@@ -143,7 +143,7 @@
});
});
-describe.only('(!negative tests!) Create NFT collection from EVM', () => {
+describe('(!negative tests!) Create NFT collection from EVM', () => {
let donor: IKeyringPair;
let nominal: bigint;
tests/src/eth/createRFTCollection.test.tsdiffbeforeafterboth--- a/tests/src/eth/createRFTCollection.test.ts
+++ b/tests/src/eth/createRFTCollection.test.ts
@@ -21,7 +21,7 @@
import {CollectionLimitField} from './util/playgrounds/types';
-describe.only('Create RFT collection from EVM', () => {
+describe('Create RFT collection from EVM', () => {
let donor: IKeyringPair;
before(async function() {
@@ -154,7 +154,7 @@
});
});
-describe.only('(!negative tests!) Create RFT collection from EVM', () => {
+describe('(!negative tests!) Create RFT collection from EVM', () => {
let donor: IKeyringPair;
let nominal: bigint;
tests/src/eth/fractionalizer/fractionalizer.test.tsdiffbeforeafterboth--- a/tests/src/eth/fractionalizer/fractionalizer.test.ts
+++ b/tests/src/eth/fractionalizer/fractionalizer.test.ts
@@ -80,7 +80,7 @@
};
-describe.only('Fractionalizer contract usage', () => {
+describe('Fractionalizer contract usage', () => {
let donor: IKeyringPair;
before(async function() {
tests/src/eth/nonFungible.test.tsdiffbeforeafterboth--- a/tests/src/eth/nonFungible.test.ts
+++ b/tests/src/eth/nonFungible.test.ts
@@ -929,7 +929,7 @@
});
});
- itEth.only('Returns collection name', async ({helper}) => {
+ itEth('Returns collection name', async ({helper}) => {
// FIXME: should not have balance to use .call()
const caller = await helper.eth.createAccountWithBalance(donor);
const tokenPropertyPermissions = [{
tests/src/eth/payable.test.tsdiffbeforeafterboth--- a/tests/src/eth/payable.test.ts
+++ b/tests/src/eth/payable.test.ts
@@ -41,7 +41,7 @@
expect(await contract.methods.getCollected().call()).to.be.equal('10000');
});
- itEth.only('Evm contract can receive wei from substrate account', async ({helper}) => {
+ itEth('Evm contract can receive wei from substrate account', async ({helper}) => {
const deployer = await helper.eth.createAccountWithBalance(donor);
const contract = await helper.eth.deployCollectorContract(deployer);
const [alice] = await helper.arrange.createAccounts([40n], donor);
tests/src/eth/reFungible.test.tsdiffbeforeafterboth--- a/tests/src/eth/reFungible.test.ts
+++ b/tests/src/eth/reFungible.test.ts
@@ -679,7 +679,7 @@
});
});
- itEth.only('Returns collection name', async ({helper}) => {
+ itEth('Returns collection name', async ({helper}) => {
// FIXME: should not have balance to use .call()
const caller = await helper.eth.createAccountWithBalance(alice);
const tokenPropertyPermissions = [{
tests/src/eth/tokenProperties.test.tsdiffbeforeafterboth--- a/tests/src/eth/tokenProperties.test.ts
+++ b/tests/src/eth/tokenProperties.test.ts
@@ -314,7 +314,7 @@
expect(result.length).to.equal(0);
}));
- itEth.only('Can be read', async({helper}) => {
+ itEth('Can be read', async({helper}) => {
// FIXME: User with no balance should be able to call
const caller = await helper.eth.createAccountWithBalance(alice);
const collection = await helper.nft.mintCollection(alice, {
tests/src/maintenance.seqtest.tsdiffbeforeafterboth--- a/tests/src/maintenance.seqtest.ts
+++ b/tests/src/maintenance.seqtest.ts
@@ -325,7 +325,7 @@
expect(await helper.preimage.getPreimageInfo(preimageHashes[0])).to.have.property('unrequested');
});
- itSub.only('Does not allow execution of a preimage that would fail', async ({helper}) => {
+ itSub('Does not allow execution of a preimage that would fail', async ({helper}) => {
const [zeroAccount] = await helper.arrange.createAccounts([0n], superuser);
const preimage = helper.constructApiCall('api.tx.balances.forceTransfer', [
tests/src/vesting.test.tsdiffbeforeafterboth--- a/tests/src/vesting.test.ts
+++ b/tests/src/vesting.test.ts
@@ -103,7 +103,7 @@
expect(balanceSender.reserved).to.eq(0n);
});
- itSub.only('cannot send more tokens than have', async ({helper}) => {
+ itSub('cannot send more tokens than have', async ({helper}) => {
const [sender, receiver] = await helper.arrange.createAccounts([1000n, 1n], donor);
const schedule = {start: 0n, period: 1n, periodCount: 1n, perPeriod: 100n * nominal};
const manyPeriodsSchedule = {start: 0n, period: 1n, periodCount: 100n, perPeriod: 10n * nominal};