difftreelog
tests(parallel): fix phantom errors
in: master
7 files changed
tests/src/approve.test.tsdiffbeforeafterboth--- a/tests/src/approve.test.ts
+++ b/tests/src/approve.test.ts
@@ -227,7 +227,7 @@
});
});
-describe('Approved amount decreases by the transferred amount.:', () => {
+describe('Approved amount decreases by the transferred amount:', () => {
let alice: IKeyringPair;
let bob: IKeyringPair;
let charlie: IKeyringPair;
tests/src/confirmSponsorship.test.tsdiffbeforeafterboth--- a/tests/src/confirmSponsorship.test.ts
+++ b/tests/src/confirmSponsorship.test.ts
@@ -73,7 +73,7 @@
});
itSub('Fungible: Transfer fees are paid by the sponsor after confirmation', async ({helper}) => {
- const collection = await helper.ft.mintCollection(alice, {name: 'col', description: 'descr', tokenPrefix: 'COL'}, 0);
+ const collection = await helper.ft.mintCollection(alice, {name: 'col', description: 'descr', tokenPrefix: 'COL'});
await collection.setSponsor(alice, bob.address);
await collection.confirmSponsorship(bob);
const bobBalanceBefore = await helper.balance.getSubstrate(bob.address);
@@ -163,7 +163,10 @@
});
itSub('NFT: Sponsoring of createItem is rate limited', async ({helper}) => {
- const collection = await helper.nft.mintCollection(alice, {name: 'col', description: 'descr', tokenPrefix: 'COL'});
+ const collection = await helper.nft.mintCollection(alice, {name: 'col', description: 'descr', tokenPrefix: 'COL', limits: {
+ sponsoredDataRateLimit: {blocks: 1000},
+ sponsorTransferTimeout: 1000,
+ }});
await collection.setSponsor(alice, bob.address);
await collection.confirmSponsorship(bob);
await collection.setPermissions(alice, {mintMode: true, access: 'AllowList'});
@@ -195,7 +198,7 @@
});
itSub('(!negative test!) Confirm sponsorship for a collection that never existed', async ({helper}) => {
- const collectionId = 1_000_000;
+ const collectionId = (1 << 32) - 1;
const confirmSponsorshipTx = async () => helper.collection.confirmSponsorship(bob, collectionId);
await expect(confirmSponsorshipTx()).to.be.rejectedWith(/common\.CollectionNotFound/);
});
tests/src/deprecated-helpers/helpers.tsdiffbeforeafterboth--- a/tests/src/deprecated-helpers/helpers.ts
+++ b/tests/src/deprecated-helpers/helpers.ts
@@ -1764,11 +1764,11 @@
return (await api.rpc.unique.collectionById(collectionId)).unwrap();
}
-/*export const describe_xcm = (
+export const describeXCM = (
process.env.RUN_XCM_TESTS
? describe
: describe.skip
-);*/
+);
export async function waitNewBlocks(blocksCount = 1): Promise<void> {
await usingApi(async (api) => {
tests/src/refungible.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 {IKeyringPair} from '@polkadot/types/types';18import {itSub, Pallets, requirePalletsOrSkip, usingPlaygrounds, expect} from './util/playgrounds';1920const MAX_REFUNGIBLE_PIECES = 1_000_000_000_000_000_000_000n;2122describe('integration test: Refungible functionality:', async () => {23 let donor: IKeyringPair;24 let alice: IKeyringPair;25 let bob: IKeyringPair;2627 before(async function() {28 await usingPlaygrounds(async (helper, privateKey) => {29 requirePalletsOrSkip(this, helper, [Pallets.ReFungible]);3031 donor = await privateKey({filename: __filename});32 [alice, bob] = await helper.arrange.createAccounts([100n, 10n], donor);33 });34 });35 36 itSub('Create refungible collection and token', async ({helper}) => {37 const collection = await helper.rft.mintCollection(alice, {name: 'test', description: 'test', tokenPrefix: 'test'});3839 const itemCountBefore = await collection.getLastTokenId();40 const token = await collection.mintToken(alice, 100n);41 42 const itemCountAfter = await collection.getLastTokenId();43 44 // What to expect45 expect(token?.tokenId).to.be.gte(itemCountBefore);46 expect(itemCountAfter).to.be.equal(itemCountBefore + 1);47 expect(itemCountAfter.toString()).to.be.equal(token?.tokenId.toString());48 });49 50 itSub('Checking RPC methods when interacting with maximum allowed values (MAX_REFUNGIBLE_PIECES)', async ({helper}) => {51 const collection = await helper.rft.mintCollection(alice, {name: 'test', description: 'test', tokenPrefix: 'test'});52 53 const token = await collection.mintToken(alice, MAX_REFUNGIBLE_PIECES);54 55 expect(await collection.getTokenBalance(token.tokenId, {Substrate: alice.address})).to.be.equal(MAX_REFUNGIBLE_PIECES);56 57 await collection.transferToken(alice, token.tokenId, {Substrate: bob.address}, MAX_REFUNGIBLE_PIECES);58 expect(await collection.getTokenBalance(token.tokenId, {Substrate: bob.address})).to.be.equal(MAX_REFUNGIBLE_PIECES);59 expect(await token.getTotalPieces()).to.be.equal(MAX_REFUNGIBLE_PIECES);60 61 await expect(collection.mintToken(alice, MAX_REFUNGIBLE_PIECES + 1n))62 .to.eventually.be.rejectedWith(/refungible\.WrongRefungiblePieces/);63 });64 65 itSub('RPC method tokenOnewrs for refungible collection and token', async ({helper}) => {66 const ethAcc = {Ethereum: '0x67fb3503a61b284dc83fa96dceec4192db47dc7c'};67 const facelessCrowd = (await helper.arrange.createAccounts(Array(7).fill(0n), donor)).map(keyring => {return {Substrate: keyring.address};});6869 const collection = await helper.rft.mintCollection(alice, {name: 'test', description: 'test', tokenPrefix: 'test'});7071 const token = await collection.mintToken(alice, 10_000n);7273 await token.transfer(alice, {Substrate: bob.address}, 1000n);74 await token.transfer(alice, ethAcc, 900n);75 76 for (let i = 0; i < 7; i++) {77 await token.transfer(alice, facelessCrowd[i], 50n * BigInt(i + 1));78 } 7980 const owners = await token.getTop10Owners();8182 // What to expect83 expect(owners).to.deep.include.members([{Substrate: alice.address}, ethAcc, {Substrate: bob.address}, ...facelessCrowd]);84 expect(owners.length).to.be.equal(10);85 86 const [eleven] = await helper.arrange.createAccounts([0n], donor);87 expect(await token.transfer(alice, {Substrate: eleven.address}, 10n)).to.be.true;88 expect((await token.getTop10Owners()).length).to.be.equal(10);89 });90 91 itSub('Transfer token pieces', async ({helper}) => {92 const collection = await helper.rft.mintCollection(alice, {name: 'test', description: 'test', tokenPrefix: 'test'});93 const token = await collection.mintToken(alice, 100n);9495 expect(await token.getBalance({Substrate: alice.address})).to.be.equal(100n);96 expect(await token.transfer(alice, {Substrate: bob.address}, 60n)).to.be.true;97 98 expect(await token.getBalance({Substrate: alice.address})).to.be.equal(40n);99 expect(await token.getBalance({Substrate: bob.address})).to.be.equal(60n);100 101 await expect(token.transfer(alice, {Substrate: bob.address}, 41n))102 .to.eventually.be.rejectedWith(/common\.TokenValueTooLow/);103 });104105 itSub('Create multiple tokens', async ({helper}) => {106 const collection = await helper.rft.mintCollection(alice, {name: 'test', description: 'test', tokenPrefix: 'test'});107 // TODO: fix mintMultipleTokens108 // await collection.mintMultipleTokens(alice, [109 // {owner: {Substrate: alice.address}, pieces: 1n},110 // {owner: {Substrate: alice.address}, pieces: 2n},111 // {owner: {Substrate: alice.address}, pieces: 100n},112 // ]);113 await helper.rft.mintMultipleTokensWithOneOwner(alice, collection.collectionId, {Substrate: alice.address}, [114 {pieces: 1n}, 115 {pieces: 2n}, 116 {pieces: 100n},117 ]);118 const lastTokenId = await collection.getLastTokenId();119 expect(lastTokenId).to.be.equal(3);120 expect(await collection.getTokenBalance(lastTokenId, {Substrate: alice.address})).to.be.equal(100n);121 });122123 itSub('Burn some pieces', async ({helper}) => {124 const collection = await helper.rft.mintCollection(alice, {name: 'test', description: 'test', tokenPrefix: 'test'});125 const token = await collection.mintToken(alice, 100n);126 expect(await collection.doesTokenExist(token.tokenId)).to.be.true;127 expect(await token.getBalance({Substrate: alice.address})).to.be.equal(100n);128 expect(await token.burn(alice, 99n)).to.be.true;129 expect(await collection.doesTokenExist(token.tokenId)).to.be.true;130 expect(await token.getBalance({Substrate: alice.address})).to.be.equal(1n);131 });132133 itSub('Burn all pieces', async ({helper}) => {134 const collection = await helper.rft.mintCollection(alice, {name: 'test', description: 'test', tokenPrefix: 'test'});135 const token = await collection.mintToken(alice, 100n);136 137 expect(await collection.doesTokenExist(token.tokenId)).to.be.true;138 expect(await token.getBalance({Substrate: alice.address})).to.be.equal(100n);139140 expect(await token.burn(alice, 100n)).to.be.true;141 expect(await collection.doesTokenExist(token.tokenId)).to.be.false;142 });143144 itSub('Burn some pieces for multiple users', async ({helper}) => {145 const collection = await helper.rft.mintCollection(alice, {name: 'test', description: 'test', tokenPrefix: 'test'});146 const token = await collection.mintToken(alice, 100n);147148 expect(await collection.doesTokenExist(token.tokenId)).to.be.true;149 150 expect(await token.getBalance({Substrate: alice.address})).to.be.equal(100n);151 expect(await token.transfer(alice, {Substrate: bob.address}, 60n)).to.be.true;152153 expect(await token.getBalance({Substrate: alice.address})).to.be.equal(40n);154 expect(await token.getBalance({Substrate: bob.address})).to.be.equal(60n);155156 expect(await token.burn(alice, 40n)).to.be.true;157158 expect(await collection.doesTokenExist(token.tokenId)).to.be.true;159 expect(await token.getBalance({Substrate: alice.address})).to.be.equal(0n);160161 expect(await token.burn(bob, 59n)).to.be.true;162163 expect(await token.getBalance({Substrate: bob.address})).to.be.equal(1n);164 expect(await collection.doesTokenExist(token.tokenId)).to.be.true;165166 expect(await token.burn(bob, 1n)).to.be.true;167168 expect(await collection.doesTokenExist(token.tokenId)).to.be.false;169 });170171 itSub('Set allowance for token', async ({helper}) => {172 const collection = await helper.rft.mintCollection(alice, {name: 'test', description: 'test', tokenPrefix: 'test'});173 const token = await collection.mintToken(alice, 100n);174 175 expect(await token.getBalance({Substrate: alice.address})).to.be.equal(100n);176177 expect(await token.approve(alice, {Substrate: bob.address}, 60n)).to.be.true;178 expect(await token.getApprovedPieces({Substrate: alice.address}, {Substrate: bob.address})).to.be.equal(60n);179180 expect(await token.transferFrom(bob, {Substrate: alice.address}, {Substrate: bob.address}, 20n)).to.be.true;181 expect(await token.getBalance({Substrate: alice.address})).to.be.equal(80n);182 expect(await token.getBalance({Substrate: bob.address})).to.be.equal(20n);183 expect(await token.getApprovedPieces({Substrate: alice.address}, {Substrate: bob.address})).to.be.equal(40n);184 });185186 itSub('Repartition', async ({helper}) => {187 const collection = await helper.rft.mintCollection(alice, {name: 'test', description: 'test', tokenPrefix: 'test'});188 const token = await collection.mintToken(alice, 100n);189190 expect(await token.repartition(alice, 200n)).to.be.true;191 expect(await token.getBalance({Substrate: alice.address})).to.be.equal(200n);192 expect(await token.getTotalPieces()).to.be.equal(200n);193 194 expect(await token.transfer(alice, {Substrate: bob.address}, 110n)).to.be.true;195 expect(await token.getBalance({Substrate: alice.address})).to.be.equal(90n);196 expect(await token.getBalance({Substrate: bob.address})).to.be.equal(110n);197 198 await expect(token.repartition(alice, 80n))199 .to.eventually.be.rejectedWith(/refungible\.RepartitionWhileNotOwningAllPieces/);200 201 expect(await token.transfer(alice, {Substrate: bob.address}, 90n)).to.be.true;202 expect(await token.getBalance({Substrate: alice.address})).to.be.equal(0n);203 expect(await token.getBalance({Substrate: bob.address})).to.be.equal(200n);204205 expect(await token.repartition(bob, 150n)).to.be.true;206 await expect(token.transfer(bob, {Substrate: alice.address}, 160n))207 .to.eventually.be.rejectedWith(/common\.TokenValueTooLow/);208 });209210 itSub('Repartition with increased amount', async ({helper}) => {211 const collection = await helper.rft.mintCollection(alice, {name: 'test', description: 'test', tokenPrefix: 'test'});212 const token = await collection.mintToken(alice, 100n);213 await token.repartition(alice, 200n);214 const chainEvents = helper.chainLog.slice(-1)[0].events;215 expect(chainEvents).to.deep.include({216 section: 'common',217 method: 'ItemCreated',218 index: [66, 2],219 data: [220 collection.collectionId,221 token.tokenId,222 {substrate: alice.address}, 223 100n,224 ],225 phase: {applyExtrinsic: 2},226 });227 });228229 itSub('Repartition with decreased amount', async ({helper}) => {230 const collection = await helper.rft.mintCollection(alice, {name: 'test', description: 'test', tokenPrefix: 'test'});231 const token = await collection.mintToken(alice, 100n);232 await token.repartition(alice, 50n);233 const chainEvents = helper.chainLog.slice(-1)[0].events;234 expect(chainEvents).to.deep.include({235 method: 'ItemDestroyed',236 section: 'common',237 index: [66, 3],238 data: [239 collection.collectionId,240 token.tokenId,241 {substrate: alice.address}, 242 50n,243 ],244 phase: {applyExtrinsic: 2},245 });246 });247 248 itSub('Create new collection with properties', async ({helper}) => {249 const properties = [{key: 'key1', value: 'val1'}];250 const tokenPropertyPermissions = [{key: 'key1', permission: {tokenOwner: true, mutable: false, collectionAdmin: true}}];251 const collection = await helper.rft.mintCollection(alice, {name: 'test', description: 'test', tokenPrefix: 'test', properties, tokenPropertyPermissions});252 const info = await collection.getData();253 expect(info?.raw.properties).to.be.deep.equal(properties);254 expect(info?.raw.tokenPropertyPermissions).to.be.deep.equal(tokenPropertyPermissions);255 });256});2571// 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 {IKeyringPair} from '@polkadot/types/types';18import {itSub, Pallets, requirePalletsOrSkip, usingPlaygrounds, expect} from './util/playgrounds';1920const MAX_REFUNGIBLE_PIECES = 1_000_000_000_000_000_000_000n;2122describe('integration test: Refungible functionality:', async () => {23 let donor: IKeyringPair;24 let alice: IKeyringPair;25 let bob: IKeyringPair;2627 before(async function() {28 await usingPlaygrounds(async (helper, privateKey) => {29 requirePalletsOrSkip(this, helper, [Pallets.ReFungible]);3031 donor = await privateKey({filename: __filename});32 [alice, bob] = await helper.arrange.createAccounts([100n, 10n], donor);33 });34 });35 36 itSub('Create refungible collection and token', async ({helper}) => {37 const collection = await helper.rft.mintCollection(alice, {name: 'test', description: 'test', tokenPrefix: 'test'});3839 const itemCountBefore = await collection.getLastTokenId();40 const token = await collection.mintToken(alice, 100n);41 42 const itemCountAfter = await collection.getLastTokenId();43 44 // What to expect45 expect(token?.tokenId).to.be.gte(itemCountBefore);46 expect(itemCountAfter).to.be.equal(itemCountBefore + 1);47 expect(itemCountAfter.toString()).to.be.equal(token?.tokenId.toString());48 });49 50 itSub('Checking RPC methods when interacting with maximum allowed values (MAX_REFUNGIBLE_PIECES)', async ({helper}) => {51 const collection = await helper.rft.mintCollection(alice, {name: 'test', description: 'test', tokenPrefix: 'test'});52 53 const token = await collection.mintToken(alice, MAX_REFUNGIBLE_PIECES);54 55 expect(await collection.getTokenBalance(token.tokenId, {Substrate: alice.address})).to.be.equal(MAX_REFUNGIBLE_PIECES);56 57 await collection.transferToken(alice, token.tokenId, {Substrate: bob.address}, MAX_REFUNGIBLE_PIECES);58 expect(await collection.getTokenBalance(token.tokenId, {Substrate: bob.address})).to.be.equal(MAX_REFUNGIBLE_PIECES);59 expect(await token.getTotalPieces()).to.be.equal(MAX_REFUNGIBLE_PIECES);60 61 await expect(collection.mintToken(alice, MAX_REFUNGIBLE_PIECES + 1n))62 .to.eventually.be.rejectedWith(/refungible\.WrongRefungiblePieces/);63 });64 65 itSub('RPC method tokenOwners for refungible collection and token', async ({helper}) => {66 const ethAcc = {Ethereum: '0x67fb3503a61b284dc83fa96dceec4192db47dc7c'};67 const facelessCrowd = (await helper.arrange.createAccounts(Array(7).fill(0n), donor)).map(keyring => {return {Substrate: keyring.address};});6869 const collection = await helper.rft.mintCollection(alice, {name: 'test', description: 'test', tokenPrefix: 'test'});7071 const token = await collection.mintToken(alice, 10_000n);7273 await token.transfer(alice, {Substrate: bob.address}, 1000n);74 await token.transfer(alice, ethAcc, 900n);75 76 for (let i = 0; i < 7; i++) {77 await token.transfer(alice, facelessCrowd[i], 50n * BigInt(i + 1));78 } 7980 const owners = await token.getTop10Owners();8182 // What to expect83 expect(owners).to.deep.include.members([{Substrate: alice.address}, ethAcc, {Substrate: bob.address}, ...facelessCrowd]);84 expect(owners.length).to.be.equal(10);85 86 const [eleven] = await helper.arrange.createAccounts([0n], donor);87 expect(await token.transfer(alice, {Substrate: eleven.address}, 10n)).to.be.true;88 expect((await token.getTop10Owners()).length).to.be.equal(10);89 });90 91 itSub('Transfer token pieces', async ({helper}) => {92 const collection = await helper.rft.mintCollection(alice, {name: 'test', description: 'test', tokenPrefix: 'test'});93 const token = await collection.mintToken(alice, 100n);9495 expect(await token.getBalance({Substrate: alice.address})).to.be.equal(100n);96 expect(await token.transfer(alice, {Substrate: bob.address}, 60n)).to.be.true;97 98 expect(await token.getBalance({Substrate: alice.address})).to.be.equal(40n);99 expect(await token.getBalance({Substrate: bob.address})).to.be.equal(60n);100 101 await expect(token.transfer(alice, {Substrate: bob.address}, 41n))102 .to.eventually.be.rejectedWith(/common\.TokenValueTooLow/);103 });104105 itSub('Create multiple tokens', async ({helper}) => {106 const collection = await helper.rft.mintCollection(alice, {name: 'test', description: 'test', tokenPrefix: 'test'});107 // TODO: fix mintMultipleTokens108 // await collection.mintMultipleTokens(alice, [109 // {owner: {Substrate: alice.address}, pieces: 1n},110 // {owner: {Substrate: alice.address}, pieces: 2n},111 // {owner: {Substrate: alice.address}, pieces: 100n},112 // ]);113 await helper.rft.mintMultipleTokensWithOneOwner(alice, collection.collectionId, {Substrate: alice.address}, [114 {pieces: 1n}, 115 {pieces: 2n}, 116 {pieces: 100n},117 ]);118 const lastTokenId = await collection.getLastTokenId();119 expect(lastTokenId).to.be.equal(3);120 expect(await collection.getTokenBalance(lastTokenId, {Substrate: alice.address})).to.be.equal(100n);121 });122123 itSub('Burn some pieces', async ({helper}) => {124 const collection = await helper.rft.mintCollection(alice, {name: 'test', description: 'test', tokenPrefix: 'test'});125 const token = await collection.mintToken(alice, 100n);126 expect(await collection.doesTokenExist(token.tokenId)).to.be.true;127 expect(await token.getBalance({Substrate: alice.address})).to.be.equal(100n);128 expect(await token.burn(alice, 99n)).to.be.true;129 expect(await collection.doesTokenExist(token.tokenId)).to.be.true;130 expect(await token.getBalance({Substrate: alice.address})).to.be.equal(1n);131 });132133 itSub('Burn all pieces', async ({helper}) => {134 const collection = await helper.rft.mintCollection(alice, {name: 'test', description: 'test', tokenPrefix: 'test'});135 const token = await collection.mintToken(alice, 100n);136 137 expect(await collection.doesTokenExist(token.tokenId)).to.be.true;138 expect(await token.getBalance({Substrate: alice.address})).to.be.equal(100n);139140 expect(await token.burn(alice, 100n)).to.be.true;141 expect(await collection.doesTokenExist(token.tokenId)).to.be.false;142 });143144 itSub('Burn some pieces for multiple users', async ({helper}) => {145 const collection = await helper.rft.mintCollection(alice, {name: 'test', description: 'test', tokenPrefix: 'test'});146 const token = await collection.mintToken(alice, 100n);147148 expect(await collection.doesTokenExist(token.tokenId)).to.be.true;149 150 expect(await token.getBalance({Substrate: alice.address})).to.be.equal(100n);151 expect(await token.transfer(alice, {Substrate: bob.address}, 60n)).to.be.true;152153 expect(await token.getBalance({Substrate: alice.address})).to.be.equal(40n);154 expect(await token.getBalance({Substrate: bob.address})).to.be.equal(60n);155156 expect(await token.burn(alice, 40n)).to.be.true;157158 expect(await collection.doesTokenExist(token.tokenId)).to.be.true;159 expect(await token.getBalance({Substrate: alice.address})).to.be.equal(0n);160161 expect(await token.burn(bob, 59n)).to.be.true;162163 expect(await token.getBalance({Substrate: bob.address})).to.be.equal(1n);164 expect(await collection.doesTokenExist(token.tokenId)).to.be.true;165166 expect(await token.burn(bob, 1n)).to.be.true;167168 expect(await collection.doesTokenExist(token.tokenId)).to.be.false;169 });170171 itSub('Set allowance for token', async ({helper}) => {172 const collection = await helper.rft.mintCollection(alice, {name: 'test', description: 'test', tokenPrefix: 'test'});173 const token = await collection.mintToken(alice, 100n);174 175 expect(await token.getBalance({Substrate: alice.address})).to.be.equal(100n);176177 expect(await token.approve(alice, {Substrate: bob.address}, 60n)).to.be.true;178 expect(await token.getApprovedPieces({Substrate: alice.address}, {Substrate: bob.address})).to.be.equal(60n);179180 expect(await token.transferFrom(bob, {Substrate: alice.address}, {Substrate: bob.address}, 20n)).to.be.true;181 expect(await token.getBalance({Substrate: alice.address})).to.be.equal(80n);182 expect(await token.getBalance({Substrate: bob.address})).to.be.equal(20n);183 expect(await token.getApprovedPieces({Substrate: alice.address}, {Substrate: bob.address})).to.be.equal(40n);184 });185186 itSub('Repartition', async ({helper}) => {187 const collection = await helper.rft.mintCollection(alice, {name: 'test', description: 'test', tokenPrefix: 'test'});188 const token = await collection.mintToken(alice, 100n);189190 expect(await token.repartition(alice, 200n)).to.be.true;191 expect(await token.getBalance({Substrate: alice.address})).to.be.equal(200n);192 expect(await token.getTotalPieces()).to.be.equal(200n);193 194 expect(await token.transfer(alice, {Substrate: bob.address}, 110n)).to.be.true;195 expect(await token.getBalance({Substrate: alice.address})).to.be.equal(90n);196 expect(await token.getBalance({Substrate: bob.address})).to.be.equal(110n);197 198 await expect(token.repartition(alice, 80n))199 .to.eventually.be.rejectedWith(/refungible\.RepartitionWhileNotOwningAllPieces/);200 201 expect(await token.transfer(alice, {Substrate: bob.address}, 90n)).to.be.true;202 expect(await token.getBalance({Substrate: alice.address})).to.be.equal(0n);203 expect(await token.getBalance({Substrate: bob.address})).to.be.equal(200n);204205 expect(await token.repartition(bob, 150n)).to.be.true;206 await expect(token.transfer(bob, {Substrate: alice.address}, 160n))207 .to.eventually.be.rejectedWith(/common\.TokenValueTooLow/);208 });209210 itSub('Repartition with increased amount', async ({helper}) => {211 const collection = await helper.rft.mintCollection(alice, {name: 'test', description: 'test', tokenPrefix: 'test'});212 const token = await collection.mintToken(alice, 100n);213 await token.repartition(alice, 200n);214 const chainEvents = helper.chainLog.slice(-1)[0].events;215 const event = chainEvents.find((event: any) => event.section === 'common' && event.method === 'ItemCreated');216 expect(event).to.deep.include({217 section: 'common',218 method: 'ItemCreated',219 index: [66, 2],220 data: [221 collection.collectionId,222 token.tokenId,223 {substrate: alice.address}, 224 100n,225 ],226 });227 });228229 itSub('Repartition with decreased amount', async ({helper}) => {230 const collection = await helper.rft.mintCollection(alice, {name: 'test', description: 'test', tokenPrefix: 'test'});231 const token = await collection.mintToken(alice, 100n);232 await token.repartition(alice, 50n);233 const chainEvents = helper.chainLog.slice(-1)[0].events;234 const event = chainEvents.find((event: any) => event.section === 'common' && event.method === 'ItemDestroyed');235 expect(event).to.deep.include({236 section: 'common',237 method: 'ItemDestroyed',238 index: [66, 3],239 data: [240 collection.collectionId,241 token.tokenId,242 {substrate: alice.address}, 243 50n,244 ],245 });246 });247 248 itSub('Create new collection with properties', async ({helper}) => {249 const properties = [{key: 'key1', value: 'val1'}];250 const tokenPropertyPermissions = [{key: 'key1', permission: {tokenOwner: true, mutable: false, collectionAdmin: true}}];251 const collection = await helper.rft.mintCollection(alice, {name: 'test', description: 'test', tokenPrefix: 'test', properties, tokenPropertyPermissions});252 const info = await collection.getData();253 expect(info?.raw.properties).to.be.deep.equal(properties);254 expect(info?.raw.tokenPropertyPermissions).to.be.deep.equal(tokenPropertyPermissions);255 });256});257tests/src/xcm/xcmOpal.test.tsdiffbeforeafterboth--- a/tests/src/xcm/xcmOpal.test.ts
+++ b/tests/src/xcm/xcmOpal.test.ts
@@ -21,7 +21,7 @@
import {ApiOptions} from '@polkadot/api/types';
import {IKeyringPair} from '@polkadot/types/types';
import usingApi, {executeTransaction} from './../substrate/substrate-api';
-import {bigIntToDecimals, describe_xcm, getGenericResult, paraSiblingSovereignAccount, normalizeAccountId} from './../deprecated-helpers/helpers';
+import {bigIntToDecimals, describeXCM, getGenericResult, paraSiblingSovereignAccount, normalizeAccountId} from './../deprecated-helpers/helpers';
import waitNewBlocks from './../substrate/wait-new-blocks';
import getBalance from './../substrate/get-balance';
@@ -49,7 +49,7 @@
// 10,000.00 (ten thousands) USDT
const ASSET_AMOUNT = 1_000_000_000_000_000_000_000n;
-describe_xcm('[XCM] Integration test: Exchanging USDT with Westmint', () => {
+describeXCM('[XCM] Integration test: Exchanging USDT with Westmint', () => {
let alice: IKeyringPair;
let bob: IKeyringPair;
tests/src/xcm/xcmQuartz.test.tsdiffbeforeafterboth--- a/tests/src/xcm/xcmQuartz.test.ts
+++ b/tests/src/xcm/xcmQuartz.test.ts
@@ -21,7 +21,7 @@
import {ApiOptions} from '@polkadot/api/types';
import {IKeyringPair} from '@polkadot/types/types';
import usingApi, {submitTransactionAsync} from '../substrate/substrate-api';
-import {getGenericResult, generateKeyringPair, waitEvent, describe_xcm, bigIntToDecimals} from '../deprecated-helpers/helpers';
+import {getGenericResult, generateKeyringPair, waitEvent, describeXCM, bigIntToDecimals} from '../deprecated-helpers/helpers';
import {MultiLocation} from '@polkadot/types/interfaces';
import {blake2AsHex} from '@polkadot/util-crypto';
import waitNewBlocks from '../substrate/wait-new-blocks';
@@ -61,7 +61,7 @@
return parachainApiOptions(RELAY_PORT);
}
-describe_xcm('[XCM] Integration test: Exchanging tokens with Karura', () => {
+describeXCM('[XCM] Integration test: Exchanging tokens with Karura', () => {
let alice: IKeyringPair;
let randomAccount: IKeyringPair;
@@ -292,7 +292,7 @@
});
// These tests are relevant only when the foreign asset pallet is disabled
-describe_xcm('[XCM] Integration test: Quartz rejects non-native tokens', () => {
+describeXCM('[XCM] Integration test: Quartz rejects non-native tokens', () => {
let alice: IKeyringPair;
before(async () => {
@@ -433,7 +433,7 @@
});
});
-describe_xcm('[XCM] Integration test: Exchanging QTZ with Moonriver', () => {
+describeXCM('[XCM] Integration test: Exchanging QTZ with Moonriver', () => {
// Quartz constants
let quartzAlice: IKeyringPair;
tests/src/xcm/xcmUnique.test.tsdiffbeforeafterboth--- a/tests/src/xcm/xcmUnique.test.ts
+++ b/tests/src/xcm/xcmUnique.test.ts
@@ -21,7 +21,7 @@
import {ApiOptions} from '@polkadot/api/types';
import {IKeyringPair} from '@polkadot/types/types';
import usingApi, {submitTransactionAsync} from '../substrate/substrate-api';
-import {getGenericResult, generateKeyringPair, waitEvent, describe_xcm, bigIntToDecimals} from '../deprecated-helpers/helpers';
+import {getGenericResult, generateKeyringPair, waitEvent, describeXCM, bigIntToDecimals} from '../deprecated-helpers/helpers';
import {MultiLocation} from '@polkadot/types/interfaces';
import {blake2AsHex} from '@polkadot/util-crypto';
import waitNewBlocks from '../substrate/wait-new-blocks';
@@ -61,7 +61,7 @@
return parachainApiOptions(RELAY_PORT);
}
-describe_xcm('[XCM] Integration test: Exchanging tokens with Acala', () => {
+describeXCM('[XCM] Integration test: Exchanging tokens with Acala', () => {
let alice: IKeyringPair;
let randomAccount: IKeyringPair;
@@ -292,7 +292,7 @@
});
// These tests are relevant only when the foreign asset pallet is disabled
-describe_xcm('[XCM] Integration test: Unique rejects non-native tokens', () => {
+describeXCM('[XCM] Integration test: Unique rejects non-native tokens', () => {
let alice: IKeyringPair;
before(async () => {
@@ -433,7 +433,7 @@
});
});
-describe_xcm('[XCM] Integration test: Exchanging UNQ with Moonbeam', () => {
+describeXCM('[XCM] Integration test: Exchanging UNQ with Moonbeam', () => {
// Unique constants
let uniqueAlice: IKeyringPair;