difftreelog
fix tests cleanup
in: master
10 files changed
tests/src/eth/collectionLimits.test.tsdiffbeforeafterboth--- a/tests/src/eth/collectionLimits.test.ts
+++ b/tests/src/eth/collectionLimits.test.ts
@@ -97,7 +97,7 @@
const owner = await helper.eth.createAccountWithBalance(donor);
const {collectionAddress} = await helper.eth.createCollection(owner, new CreateCollectionData('Limits', 'absolutely anything', 'ISNI', testCase.case, 18)).send();
- const collectionEvm = await helper.ethNativeContract.collection(collectionAddress, testCase.case, owner);
+ const collectionEvm = helper.ethNativeContract.collection(collectionAddress, testCase.case, owner);
// Cannot set non-existing limit
await expect(collectionEvm.methods
tests/src/eth/createCollection.test.tsdiffbeforeafterboth232324const DECIMALS = 18;24const DECIMALS = 18;25const CREATE_COLLECTION_DATA_DEFAULTS_ARRAY = [25const CREATE_COLLECTION_DATA_DEFAULTS_ARRAY = [26 [],26 [], // properties27 [],27 [], // tokenPropertyPermissions28 [],28 [], // adminList29 [false, false, []],29 [false, false, []], // nestingSettings30 [],30 [], // limits31 [0],31 emptyAddress, // pendingSponsor32 [0], // flags32];33];333434type ElementOf<A> = A extends readonly (infer T)[] ? T : never;35type ElementOf<A> = A extends readonly (infer T)[] ? T : never;64 itEth('Collection address exist', async ({helper}) => {65 itEth('Collection address exist', async ({helper}) => {65 const owner = await helper.eth.createAccountWithBalance(donor);66 const owner = await helper.eth.createAccountWithBalance(donor);66 const collectionAddressForNonexistentCollection = '0x17C4E6453CC49AAAAEACA894E6D9683E00112233';67 const collectionAddressForNonexistentCollection = '0x17C4E6453CC49AAAAEACA894E6D9683E00112233';67 const collectionHelpers = await helper.ethNativeContract.collectionHelpers(owner);68 const collectionHelpers = helper.ethNativeContract.collectionHelpers(owner);686969 expect(await collectionHelpers70 expect(await collectionHelpers70 .methods.isCollectionExist(collectionAddressForNonexistentCollection).call())71 .methods.isCollectionExist(collectionAddressForNonexistentCollection).call())76 .to.be.true;77 .to.be.true;777878 // check collectionOwner:79 // check collectionOwner:79 const collectionEvm = await helper.ethNativeContract.collection(collectionAddress, 'ft', owner, true);80 const collectionEvm = helper.ethNativeContract.collection(collectionAddress, 'ft', owner, true);80 const collectionOwner = await collectionEvm.methods.collectionOwner().call();81 const collectionOwner = await collectionEvm.methods.collectionOwner().call();81 expect(helper.address.restoreCrossAccountFromBigInt(BigInt(collectionOwner.sub))).to.eq(helper.address.ethToSubstrate(owner, true));82 expect(helper.address.restoreCrossAccountFromBigInt(BigInt(collectionOwner.sub))).to.eq(helper.address.ethToSubstrate(owner, true));82 });83 });838484 itEth('destroyCollection', async ({helper}) => {85 itEth('destroyCollection', async ({helper}) => {85 const owner = await helper.eth.createAccountWithBalance(donor);86 const owner = await helper.eth.createAccountWithBalance(donor);86 const {collectionAddress, collectionId} = await helper.eth.createCollection(owner, new CreateCollectionData('Exister', 'absolutely anything', 'WIWT', 'ft', DECIMALS)).send();87 const {collectionAddress, collectionId} = await helper.eth.createCollection(owner, new CreateCollectionData('Exister', 'absolutely anything', 'WIWT', 'ft', DECIMALS)).send();87 const collectionHelper = await helper.ethNativeContract.collectionHelpers(owner);88 const collectionHelper = helper.ethNativeContract.collectionHelpers(owner);888989 const result = await collectionHelper.methods90 const result = await collectionHelper.methods90 .destroyCollection(collectionAddress)91 .destroyCollection(collectionAddress)110111111 itEth('(!negative test!) Create collection (bad lengths)', async ({helper}) => {112 itEth('(!negative test!) Create collection (bad lengths)', async ({helper}) => {112 const owner = await helper.eth.createAccountWithBalance(donor);113 const owner = await helper.eth.createAccountWithBalance(donor);113 const collectionHelper = await helper.ethNativeContract.collectionHelpers(owner);114 const collectionHelper = helper.ethNativeContract.collectionHelpers(owner);114 {115 {115 const MAX_NAME_LENGTH = 64;116 const MAX_NAME_LENGTH = 64;116 const collectionName = 'A'.repeat(MAX_NAME_LENGTH + 1);117 const collectionName = 'A'.repeat(MAX_NAME_LENGTH + 1);119120120 await expect(collectionHelper.methods121 await expect(collectionHelper.methods121 .createCollection([122 .createCollection([122 emptyAddress,123 collectionName,123 collectionName,124 description,124 description,125 tokenPrefix,125 tokenPrefix,136 const tokenPrefix = 'A';136 const tokenPrefix = 'A';137 await expect(collectionHelper.methods137 await expect(collectionHelper.methods138 .createCollection([138 .createCollection([139 emptyAddress,140 collectionName,139 collectionName,141 description,140 description,142 tokenPrefix,141 tokenPrefix,153 const tokenPrefix = 'A'.repeat(MAX_TOKEN_PREFIX_LENGTH + 1);152 const tokenPrefix = 'A'.repeat(MAX_TOKEN_PREFIX_LENGTH + 1);154 await expect(collectionHelper.methods153 await expect(collectionHelper.methods155 .createCollection([154 .createCollection([156 emptyAddress,157 collectionName,155 collectionName,158 description,156 description,159 tokenPrefix,157 tokenPrefix,167165168 itEth('(!negative test!) cannot create collection if value !== 2', async ({helper}) => {166 itEth('(!negative test!) cannot create collection if value !== 2', async ({helper}) => {169 const owner = await helper.eth.createAccountWithBalance(donor);167 const owner = await helper.eth.createAccountWithBalance(donor);170 const collectionHelper = await helper.ethNativeContract.collectionHelpers(owner);168 const collectionHelper = helper.ethNativeContract.collectionHelpers(owner);171 const expects = [0n, 1n, 30n].map(async value => {169 const expects = [0n, 1n, 30n].map(async value => {172 await expect(collectionHelper.methods170 await expect(collectionHelper.methods173 .createCollection([171 .createCollection([174 emptyAddress,175 'Peasantry',172 'Peasantry',176 'absolutely anything',173 'absolutely anything',177 'TWIW',174 'TWIW',238235239 const expectedCollectionId = +(await helper.callRpc('api.rpc.unique.collectionStats')).created + 1;236 const expectedCollectionId = +(await helper.callRpc('api.rpc.unique.collectionStats')).created + 1;240 const expectedCollectionAddress = helper.ethAddress.fromCollectionId(expectedCollectionId);237 const expectedCollectionAddress = helper.ethAddress.fromCollectionId(expectedCollectionId);241 const collectionHelpers = await helper.ethNativeContract.collectionHelpers(owner);238 const collectionHelpers = helper.ethNativeContract.collectionHelpers(owner);242239243 expect(await collectionHelpers.methods240 expect(await collectionHelpers.methods244 .isCollectionExist(expectedCollectionAddress)241 .isCollectionExist(expectedCollectionAddress)245 .call()).to.be.false;242 .call()).to.be.false;246243247 await collectionHelpers.methods244 await collectionHelpers.methods248 .createCollection([245 .createCollection([249 emptyAddress,250 'A',246 'A',251 'A',247 'A',252 'A',248 'A',331 const ss58Format = helper.chain.getChainProperties().ss58Format;327 const ss58Format = helper.chain.getChainProperties().ss58Format;332 const {collectionId, collectionAddress} = await helper.eth.createCollection(owner, new CreateCollectionData('Sponsor', 'absolutely anything', 'ENVY', 'rft')).send();328 const {collectionId, collectionAddress} = await helper.eth.createCollection(owner, new CreateCollectionData('Sponsor', 'absolutely anything', 'ENVY', 'rft')).send();333329334 const collection = await helper.ethNativeContract.collection(collectionAddress, 'rft', owner);330 const collection = helper.ethNativeContract.collection(collectionAddress, 'rft', owner);335 const sponsorCross = helper.ethCrossAccount.fromAddress(sponsor);331 const sponsorCross = helper.ethCrossAccount.fromAddress(sponsor);336 await collection.methods.setCollectionSponsorCross(sponsorCross).send();332 await collection.methods.setCollectionSponsorCross(sponsorCross).send();337333340336341 await expect(collection.methods.confirmCollectionSponsorship().call()).to.be.rejectedWith('ConfirmSponsorshipFail');337 await expect(collection.methods.confirmCollectionSponsorship().call()).to.be.rejectedWith('ConfirmSponsorshipFail');342338343 const sponsorCollection = await helper.ethNativeContract.collection(collectionAddress, 'rft', sponsor);339 const sponsorCollection = helper.ethNativeContract.collection(collectionAddress, 'rft', sponsor);344 await sponsorCollection.methods.confirmCollectionSponsorship().send();340 await sponsorCollection.methods.confirmCollectionSponsorship().send();345341346 data = (await helper.rft.getData(collectionId))!;342 data = (await helper.rft.getData(collectionId))!;350 itEth('Collection address exist', async ({helper}) => {346 itEth('Collection address exist', async ({helper}) => {351 const owner = await helper.eth.createAccountWithBalance(donor);347 const owner = await helper.eth.createAccountWithBalance(donor);352 const collectionAddressForNonexistentCollection = '0x17C4E6453CC49AAAAEACA894E6D9683E00112233';348 const collectionAddressForNonexistentCollection = '0x17C4E6453CC49AAAAEACA894E6D9683E00112233';353 const collectionHelpers = await helper.ethNativeContract.collectionHelpers(owner);349 const collectionHelpers = helper.ethNativeContract.collectionHelpers(owner);354350355 expect(await collectionHelpers351 expect(await collectionHelpers356 .methods.isCollectionExist(collectionAddressForNonexistentCollection).call())352 .methods.isCollectionExist(collectionAddressForNonexistentCollection).call())362 .to.be.true;358 .to.be.true;363359364 // check collectionOwner:360 // check collectionOwner:365 const collectionEvm = await helper.ethNativeContract.collection(collectionAddress, 'ft', owner, true);361 const collectionEvm = helper.ethNativeContract.collection(collectionAddress, 'ft', owner, true);366 const collectionOwner = await collectionEvm.methods.collectionOwner().call();362 const collectionOwner = await collectionEvm.methods.collectionOwner().call();367 expect(helper.address.restoreCrossAccountFromBigInt(BigInt(collectionOwner.sub))).to.eq(helper.address.ethToSubstrate(owner, true));363 expect(helper.address.restoreCrossAccountFromBigInt(BigInt(collectionOwner.sub))).to.eq(helper.address.ethToSubstrate(owner, true));368 });364 });369365370 itEth('destroyCollection', async ({helper}) => {366 itEth('destroyCollection', async ({helper}) => {371 const owner = await helper.eth.createAccountWithBalance(donor);367 const owner = await helper.eth.createAccountWithBalance(donor);372 const {collectionAddress, collectionId} = await helper.eth.createCollection(owner, new CreateCollectionData('Limits', 'absolutely anything', 'OLF', 'rft')).send();368 const {collectionAddress, collectionId} = await helper.eth.createCollection(owner, new CreateCollectionData('Limits', 'absolutely anything', 'OLF', 'rft')).send();373 const collectionHelper = await helper.ethNativeContract.collectionHelpers(owner);369 const collectionHelper = helper.ethNativeContract.collectionHelpers(owner);374370375 await expect(collectionHelper.methods371 await expect(collectionHelper.methods376 .destroyCollection(collectionAddress)372 .destroyCollection(collectionAddress)384380385 itEth('(!negative test!) Create collection (bad lengths)', async ({helper}) => {381 itEth('(!negative test!) Create collection (bad lengths)', async ({helper}) => {386 const owner = await helper.eth.createAccountWithBalance(donor);382 const owner = await helper.eth.createAccountWithBalance(donor);387 const collectionHelper = await helper.ethNativeContract.collectionHelpers(owner);383 const collectionHelper = helper.ethNativeContract.collectionHelpers(owner);388 {384 {389 const MAX_NAME_LENGTH = 64;385 const MAX_NAME_LENGTH = 64;390 const collectionName = 'A'.repeat(MAX_NAME_LENGTH + 1);386 const collectionName = 'A'.repeat(MAX_NAME_LENGTH + 1);393389394 await expect(collectionHelper.methods390 await expect(collectionHelper.methods395 .createCollection([391 .createCollection([396 emptyAddress,397 collectionName,392 collectionName,398 description,393 description,399 tokenPrefix,394 tokenPrefix,410 const tokenPrefix = 'A';405 const tokenPrefix = 'A';411 await expect(collectionHelper.methods406 await expect(collectionHelper.methods412 .createCollection([407 .createCollection([413 emptyAddress,414 collectionName,408 collectionName,415 description,409 description,416 tokenPrefix,410 tokenPrefix,427 const tokenPrefix = 'A'.repeat(MAX_TOKEN_PREFIX_LENGTH + 1);421 const tokenPrefix = 'A'.repeat(MAX_TOKEN_PREFIX_LENGTH + 1);428 await expect(collectionHelper.methods422 await expect(collectionHelper.methods429 .createCollection([423 .createCollection([430 emptyAddress,431 collectionName,424 collectionName,432 description,425 description,433 tokenPrefix,426 tokenPrefix,441434442 itEth('(!negative test!) Create collection (no funds)', async ({helper}) => {435 itEth('(!negative test!) Create collection (no funds)', async ({helper}) => {443 const owner = await helper.eth.createAccountWithBalance(donor);436 const owner = await helper.eth.createAccountWithBalance(donor);444 const collectionHelper = await helper.ethNativeContract.collectionHelpers(owner);437 const collectionHelper = helper.ethNativeContract.collectionHelpers(owner);445 await expect(collectionHelper.methods438 await expect(collectionHelper.methods446 .createCollection([439 .createCollection([447 emptyAddress,448 'Peasantry',440 'Peasantry',449 'absolutely anything',441 'absolutely anything',450 'TWIW',442 'TWIW',473 pendingSponsor: sponsorCross,465 pendingSponsor: sponsorCross,474 },466 },475 ).send();467 ).send();476 const collectionEvm = await helper.ethNativeContract.collection(collectionAddress, 'nft', owner);468 const collectionEvm = helper.ethNativeContract.collection(collectionAddress, 'nft', owner);477469478 expect(await collectionEvm.methods.hasCollectionPendingSponsor().call({from: owner})).to.be.true;470 expect(await collectionEvm.methods.hasCollectionPendingSponsor().call({from: owner})).to.be.true;479471657 '',649 '',658 );650 );659 const collectionSub = helper.nft.getCollectionObject(collectionId);651 const collectionSub = helper.nft.getCollectionObject(collectionId);660 const collectionEvm = await helper.ethNativeContract.collection(collectionAddress, 'nft', owner);652 const collectionEvm = helper.ethNativeContract.collection(collectionAddress, 'nft', owner);661653662 // Set and confirm sponsor:654 // Set and confirm sponsor:663 await collectionEvm.methods.confirmCollectionSponsorship().send({from: sponsorEth});655 await collectionEvm.methods.confirmCollectionSponsorship().send({from: sponsorEth});695 '',687 '',696 );688 );697 const receiver = await helper.eth.createAccountWithBalance(donor);689 const receiver = await helper.eth.createAccountWithBalance(donor);698 const collectionEvm = await helper.ethNativeContract.collection(collectionAddress, 'rft', owner);690 const collectionEvm = helper.ethNativeContract.collection(collectionAddress, 'rft', owner);699691700 await collectionEvm.methods.confirmCollectionSponsorship().send({from: sponsor});692 await collectionEvm.methods.confirmCollectionSponsorship().send({from: sponsor});701693764 adminList: [adminCrossSub, adminCrossEth],756 adminList: [adminCrossSub, adminCrossEth],765 },757 },766 ).send();758 ).send();767 const collectionEvm = await helper.ethNativeContract.collection(collectionAddress, testCase.mode, owner, true);759 const collectionEvm = helper.ethNativeContract.collection(collectionAddress, testCase.mode, owner, true);768760769 // 1. Expect api.rpc.unique.adminlist returns admins:761 // 1. Expect api.rpc.unique.adminlist returns admins:770 const adminListRpc = await helper.collection.getAdmins(collectionId);762 const adminListRpc = await helper.collection.getAdmins(collectionId);801 },793 },802 'uri',794 'uri',803 );795 );804 const collectionEvm = await helper.ethNativeContract.collection(collectionAddress, 'nft', owner, true);796 const collectionEvm = helper.ethNativeContract.collection(collectionAddress, 'nft', owner, true);805797806 // admin (sub and eth) can mint token:798 // admin (sub and eth) can mint token:807 await collectionEvm.methods.mint(owner).send({from: adminEth});799 await collectionEvm.methods.mint(owner).send({from: adminEth});852 },844 },853 ).send();845 ).send();854846855 const collectionEvm = await helper.ethNativeContract.collection(collectionAddress, 'nft', owner);847 const collectionEvm = helper.ethNativeContract.collection(collectionAddress, 'nft', owner);856848857 {849 {858 const adminList = await helper.collection.getAdmins(collectionId);850 const adminList = await helper.collection.getAdmins(collectionId);1062 },1054 },1063 ).send();1055 ).send();106410561065 const collectionEvm = await helper.ethNativeContract.collection(collectionAddress, testCase.mode, caller);1057 const collectionEvm = helper.ethNativeContract.collection(collectionAddress, testCase.mode, caller);106610581067 await collectionEvm.methods.deleteCollectionProperties(['testKey1', 'testKey2']).send({from: caller});1059 await collectionEvm.methods.deleteCollectionProperties(['testKey1', 'testKey2']).send({from: caller});106810601162 ],1154 ],1163 },1155 },1164 ).send();1156 ).send();1165 const collection = await helper.ethNativeContract.collection(collectionAddress, testCase.mode, owner);1157 const collection = helper.ethNativeContract.collection(collectionAddress, testCase.mode, owner);116611581167 expect(await helper[testCase.mode].getPropertyPermissions(collectionId)).to.be.deep.equal([{1159 expect(await helper[testCase.mode].getPropertyPermissions(collectionId)).to.be.deep.equal([{1168 key: 'testKey',1160 key: 'testKey',1287 },1279 },1288 ).send();1280 ).send();128912811290 const collection = await helper.ethNativeContract.collection(collectionAddress, testCase.mode, caller);1282 const collection = helper.ethNativeContract.collection(collectionAddress, testCase.mode, caller);1291 const tokenId = (await collection.methods.mintCross(receiver, [{key: 'testKey', value: Buffer.from('testValue')}, {key: 'testKey_1', value: Buffer.from('testValue_1')}]).send()).events.Transfer.returnValues.tokenId;1283 const tokenId = (await collection.methods.mintCross(receiver, [{key: 'testKey', value: Buffer.from('testValue')}, {key: 'testKey_1', value: Buffer.from('testValue_1')}]).send()).events.Transfer.returnValues.tokenId;1292 expect(await collection.methods.properties(tokenId, ['testKey', 'testKey_1']).call()).to.has.length(2);1284 expect(await collection.methods.properties(tokenId, ['testKey', 'testKey_1']).call()).to.has.length(2);129312851311 },1303 },1312 ).send();1304 ).send();131313051314 const contract = await helper.ethNativeContract.collection(collectionAddress, 'nft', owner);1306 const contract = helper.ethNativeContract.collection(collectionAddress, 'nft', owner);131513071316 // Create a token to be nested to1308 // Create a token to be nested to1317 const mintingTargetNFTTokenIdResult = await contract.methods.mint(owner).send({from: owner});1309 const mintingTargetNFTTokenIdResult = await contract.methods.mint(owner).send({from: owner});1342 new CreateCollectionData('A', 'B', 'C', 'nft'),1334 new CreateCollectionData('A', 'B', 'C', 'nft'),1343 ).send();1335 ).send();134413361345 const unnestedContract = await helper.ethNativeContract.collection(unnestedCollectionAddress, 'nft', owner);1337 const unnestedContract = helper.ethNativeContract.collection(unnestedCollectionAddress, 'nft', owner);1346 expect(await unnestedContract.methods.collectionNesting().call({from: owner})).to.be.like([false, false, []]);1338 expect(await unnestedContract.methods.collectionNesting().call({from: owner})).to.be.like([false, false, []]);134713391348 const {collectionAddress} = await helper.eth.createCollection(1340 const {collectionAddress} = await helper.eth.createCollection(1357 },1349 },1358 ).send();1350 ).send();135913511360 const contract = await helper.ethNativeContract.collection(collectionAddress, 'nft', owner);1352 const contract = helper.ethNativeContract.collection(collectionAddress, 'nft', owner);1361 expect(await contract.methods.collectionNesting().call({from: owner})).to.be.like([true, false, [unnestedCollectionAddress.toString()]]);1353 expect(await contract.methods.collectionNesting().call({from: owner})).to.be.like([true, false, [unnestedCollectionAddress.toString()]]);1362 await contract.methods.setCollectionNesting([false, false, []]).send({from: owner});1354 await contract.methods.setCollectionNesting([false, false, []]).send({from: owner});1363 expect(await contract.methods.collectionNesting().call({from: owner})).to.be.like([false, false, []]);1355 expect(await contract.methods.collectionNesting().call({from: owner})).to.be.like([false, false, []]);1378 },1370 },1379 ).send();1371 ).send();138013721381 const contract = await helper.ethNativeContract.collection(collectionAddress, 'nft', owner);1373 const contract = helper.ethNativeContract.collection(collectionAddress, 'nft', owner);138213741383 // Create a token to nest into1375 // Create a token to nest into1384 const mintingTargetTokenIdResult = await contract.methods.mint(owner).send({from: owner});1376 const mintingTargetTokenIdResult = await contract.methods.mint(owner).send({from: owner});1419 }1411 }1420 });1412 });142114131422 itEth('NFT: foreign flag number is ignored', async ({helper}) => {1414 itEth('NFT: can\'t set foreign flag number', async ({helper}) => {1423 const owner = await helper.eth.createAccountWithBalance(donor);1415 const owner = await helper.eth.createAccountWithBalance(donor);142414161425 {1417 {1426 const {collectionId} = await helper.eth.createCollection(owner, {...createCollectionData, flags: 128}).send();1418 await expect(helper.eth.createCollection(owner, {...createCollectionData, flags: 128}).call({from: owner})).to.be.rejectedWith(/internal flags were used/);1427 expect((await helper.nft.getData(collectionId))?.raw.flags).to.be.deep.equal({foreign: false, erc721metadata: false});1428 }1419 }142914201430 {1421 {1431 const {collectionId} = await helper.eth.createCollection(owner, {...createCollectionData, flags: 192}).send();1422 await expect(helper.eth.createCollection(owner, {...createCollectionData, flags: 192}).call({from: owner})).to.be.rejectedWith(/internal flags were used/);1432 expect((await helper.nft.getData(collectionId))?.raw.flags).to.be.deep.equal({foreign: false, erc721metadata: true});1433 }1423 }1434 });1424 });143514251446 const owner = await helper.eth.createAccountWithBalance(donor);1436 const owner = await helper.eth.createAccountWithBalance(donor);144714371448 {1438 {1449 const {collectionId} = await helper.eth.createCollection(owner, {...createCollectionData, flags: [CollectionFlag.Foreign]}).send();1439 await expect(helper.eth.createCollection(owner, {...createCollectionData, flags: [CollectionFlag.Foreign]}).call({from: owner})).to.be.rejectedWith(/internal flags were used/);1450 expect((await helper.nft.getData(collectionId))?.raw.flags).to.be.deep.equal({foreign: false, erc721metadata: false});1451 }1440 }145214411453 {1442 {1454 const {collectionId} = await helper.eth.createCollection(owner, {...createCollectionData, flags: [CollectionFlag.Erc721metadata | CollectionFlag.Foreign]}).send();1443 await expect(helper.eth.createCollection(owner, {...createCollectionData, flags: [CollectionFlag.Erc721metadata | CollectionFlag.Foreign]}).call({from: owner})).to.be.rejectedWith(/internal flags were used/);1455 expect((await helper.nft.getData(collectionId))?.raw.flags).to.be.deep.equal({foreign: false, erc721metadata: true});1456 }1444 }1457 });1445 });1458 });1446 });tests/src/eth/createFTCollection.seqtest.tsdiffbeforeafterboth--- a/tests/src/eth/createFTCollection.seqtest.ts
+++ b/tests/src/eth/createFTCollection.seqtest.ts
@@ -59,7 +59,7 @@
const expectedCollectionId = +(await helper.callRpc('api.rpc.unique.collectionStats')).created + 1;
const expectedCollectionAddress = helper.ethAddress.fromCollectionId(expectedCollectionId);
- const collectionHelpers = await helper.ethNativeContract.collectionHelpers(owner);
+ const collectionHelpers = helper.ethNativeContract.collectionHelpers(owner);
expect(await collectionHelpers.methods
.isCollectionExist(expectedCollectionAddress)
tests/src/eth/createFTCollection.test.tsdiffbeforeafterboth--- a/tests/src/eth/createFTCollection.test.ts
+++ b/tests/src/eth/createFTCollection.test.ts
@@ -50,7 +50,7 @@
await expect(collection.methods.confirmCollectionSponsorship().call()).to.be.rejectedWith('ConfirmSponsorshipFail');
- const sponsorCollection = await helper.ethNativeContract.collection(collectionAddress, 'rft', sponsor, true);
+ const sponsorCollection = helper.ethNativeContract.collection(collectionAddress, 'rft', sponsor, true);
await sponsorCollection.methods.confirmCollectionSponsorship().send();
data = (await helper.rft.getData(collectionId))!;
@@ -64,7 +64,7 @@
const description = 'absolutely anything';
const {collectionId, collectionAddress} = await helper.eth.createFungibleCollection(owner, 'Sponsor', DECIMALS, description, 'ENVY');
- const collection = await helper.ethNativeContract.collection(collectionAddress, 'rft', owner);
+ const collection = helper.ethNativeContract.collection(collectionAddress, 'rft', owner);
const sponsorCross = helper.ethCrossAccount.fromAddress(sponsor);
await collection.methods.setCollectionSponsorCross(sponsorCross).send();
@@ -73,7 +73,7 @@
await expect(collection.methods.confirmCollectionSponsorship().call()).to.be.rejectedWith('ConfirmSponsorshipFail');
- const sponsorCollection = await helper.ethNativeContract.collection(collectionAddress, 'rft', sponsor);
+ const sponsorCollection = helper.ethNativeContract.collection(collectionAddress, 'rft', sponsor);
await sponsorCollection.methods.confirmCollectionSponsorship().send();
data = (await helper.rft.getData(collectionId))!;
@@ -84,7 +84,7 @@
itEth('Collection address exist', async ({helper}) => {
const owner = await helper.eth.createAccountWithBalance(donor);
const collectionAddressForNonexistentCollection = '0x17C4E6453CC49AAAAEACA894E6D9683E00112233';
- const collectionHelpers = await helper.ethNativeContract.collectionHelpers(owner);
+ const collectionHelpers = helper.ethNativeContract.collectionHelpers(owner);
expect(await collectionHelpers
.methods.isCollectionExist(collectionAddressForNonexistentCollection).call())
@@ -96,7 +96,7 @@
.to.be.true;
// check collectionOwner:
- const collectionEvm = await helper.ethNativeContract.collection(collectionAddress, 'ft', owner, true);
+ const collectionEvm = helper.ethNativeContract.collection(collectionAddress, 'ft', owner, true);
const collectionOwner = await collectionEvm.methods.collectionOwner().call();
expect(helper.address.restoreCrossAccountFromBigInt(BigInt(collectionOwner.sub))).to.eq(helper.address.ethToSubstrate(owner, true));
});
@@ -104,7 +104,7 @@
itEth('destroyCollection', async ({helper}) => {
const owner = await helper.eth.createAccountWithBalance(donor);
const {collectionAddress, collectionId} = await helper.eth.createFungibleCollection(owner, 'Exister', DECIMALS, 'absolutely anything', 'WIWT');
- const collectionHelper = await helper.ethNativeContract.collectionHelpers(owner);
+ const collectionHelper = helper.ethNativeContract.collectionHelpers(owner);
const result = await collectionHelper.methods
.destroyCollection(collectionAddress)
@@ -143,7 +143,7 @@
itEth('(!negative test!) Create collection (bad lengths)', async ({helper}) => {
const owner = await helper.eth.createAccountWithBalance(donor);
- const collectionHelper = await helper.ethNativeContract.collectionHelpers(owner);
+ const collectionHelper = helper.ethNativeContract.collectionHelpers(owner);
{
const MAX_NAME_LENGTH = 64;
const collectionName = 'A'.repeat(MAX_NAME_LENGTH + 1);
@@ -176,7 +176,7 @@
itEth('(!negative test!) cannot create collection if value !== 2', async ({helper}) => {
const owner = await helper.eth.createAccountWithBalance(donor);
- const collectionHelper = await helper.ethNativeContract.collectionHelpers(owner);
+ const collectionHelper = helper.ethNativeContract.collectionHelpers(owner);
const expects = [0n, 1n, 30n].map(async value => {
await expect(collectionHelper.methods
.createFTCollection('Peasantry', DECIMALS, 'absolutely anything', 'TWIW')
@@ -190,7 +190,7 @@
const owner = await helper.eth.createAccountWithBalance(donor);
const peasant = helper.eth.createAccount();
const {collectionAddress} = await helper.eth.createFungibleCollection(owner, 'Transgressed', DECIMALS, 'absolutely anything', 'YVNE');
- const peasantCollection = await helper.ethNativeContract.collection(collectionAddress, 'ft', peasant, true);
+ const peasantCollection = helper.ethNativeContract.collection(collectionAddress, 'ft', peasant, true);
const EXPECTED_ERROR = 'NoPermission';
{
const sponsor = await helper.eth.createAccountWithBalance(donor);
@@ -198,7 +198,7 @@
.setCollectionSponsor(sponsor)
.call()).to.be.rejectedWith(EXPECTED_ERROR);
- const sponsorCollection = await helper.ethNativeContract.collection(collectionAddress, 'ft', sponsor, true);
+ const sponsorCollection = helper.ethNativeContract.collection(collectionAddress, 'ft', sponsor, true);
await expect(sponsorCollection.methods
.confirmCollectionSponsorship()
.call()).to.be.rejectedWith('ConfirmSponsorshipFail');
@@ -214,7 +214,7 @@
const owner = await helper.eth.createAccountWithBalance(donor);
const peasant = helper.eth.createAccount();
const {collectionAddress} = await helper.eth.createFungibleCollection(owner, 'Transgressed', DECIMALS, 'absolutely anything', 'YVNE');
- const peasantCollection = await helper.ethNativeContract.collection(collectionAddress, 'ft', peasant);
+ const peasantCollection = helper.ethNativeContract.collection(collectionAddress, 'ft', peasant);
const EXPECTED_ERROR = 'NoPermission';
{
const sponsor = await helper.eth.createAccountWithBalance(donor);
@@ -223,7 +223,7 @@
.setCollectionSponsorCross(sponsorCross)
.call()).to.be.rejectedWith(EXPECTED_ERROR);
- const sponsorCollection = await helper.ethNativeContract.collection(collectionAddress, 'ft', sponsor);
+ const sponsorCollection = helper.ethNativeContract.collection(collectionAddress, 'ft', sponsor);
await expect(sponsorCollection.methods
.confirmCollectionSponsorship()
.call()).to.be.rejectedWith('ConfirmSponsorshipFail');
tests/src/eth/createNFTCollection.seqtest.tsdiffbeforeafterboth--- a/tests/src/eth/createNFTCollection.seqtest.ts
+++ b/tests/src/eth/createNFTCollection.seqtest.ts
@@ -72,7 +72,7 @@
const expectedCollectionId = +(await helper.callRpc('api.rpc.unique.collectionStats')).created + 1;
const expectedCollectionAddress = helper.ethAddress.fromCollectionId(expectedCollectionId);
- const collectionHelpers = await helper.ethNativeContract.collectionHelpers(owner);
+ const collectionHelpers = helper.ethNativeContract.collectionHelpers(owner);
expect(await collectionHelpers.methods
.isCollectionExist(expectedCollectionAddress)
tests/src/eth/createNFTCollection.test.tsdiffbeforeafterboth--- a/tests/src/eth/createNFTCollection.test.ts
+++ b/tests/src/eth/createNFTCollection.test.ts
@@ -39,7 +39,7 @@
const baseUri = 'BaseURI';
const {collectionId, collectionAddress, events} = await helper.eth.createERC721MetadataCompatibleNFTCollection(owner, name, description, prefix, baseUri);
- const contract = await helper.ethNativeContract.collection(collectionAddress, 'nft');
+ const contract = helper.ethNativeContract.collection(collectionAddress, 'nft');
expect(events).to.be.deep.equal([
{
@@ -82,7 +82,7 @@
const ss58Format = helper.chain.getChainProperties().ss58Format;
const {collectionId, collectionAddress} = await helper.eth.createNFTCollection(owner, 'Sponsor', 'absolutely anything', 'ROC');
- const collection = await helper.ethNativeContract.collection(collectionAddress, 'nft', owner, true);
+ const collection = helper.ethNativeContract.collection(collectionAddress, 'nft', owner, true);
await collection.methods.setCollectionSponsor(sponsor).send();
let data = (await helper.nft.getData(collectionId))!;
@@ -90,7 +90,7 @@
await expect(collection.methods.confirmCollectionSponsorship().call()).to.be.rejectedWith('ConfirmSponsorshipFail');
- const sponsorCollection = await helper.ethNativeContract.collection(collectionAddress, 'nft', sponsor, true);
+ const sponsorCollection = helper.ethNativeContract.collection(collectionAddress, 'nft', sponsor, true);
await sponsorCollection.methods.confirmCollectionSponsorship().send();
data = (await helper.nft.getData(collectionId))!;
@@ -104,7 +104,7 @@
const description = 'absolutely anything';
const {collectionId, collectionAddress} = await helper.eth.createNFTCollection(owner, 'Sponsor', description, 'ROC');
- const collection = await helper.ethNativeContract.collection(collectionAddress, 'nft', owner);
+ const collection = helper.ethNativeContract.collection(collectionAddress, 'nft', owner);
const sponsorCross = helper.ethCrossAccount.fromAddress(sponsor);
await collection.methods.setCollectionSponsorCross(sponsorCross).send();
@@ -125,7 +125,7 @@
itEth('Collection address exist', async ({helper}) => {
const owner = await helper.eth.createAccountWithBalance(donor);
const collectionAddressForNonexistentCollection = '0x17C4E6453CC49AAAAEACA894E6D9683E00112233';
- const collectionHelpers = await helper.ethNativeContract.collectionHelpers(owner);
+ const collectionHelpers = helper.ethNativeContract.collectionHelpers(owner);
expect(await collectionHelpers
.methods.isCollectionExist(collectionAddressForNonexistentCollection).call())
@@ -137,7 +137,7 @@
.to.be.true;
// check collectionOwner:
- const collectionEvm = await helper.ethNativeContract.collection(collectionAddress, 'ft', owner, true);
+ const collectionEvm = helper.ethNativeContract.collection(collectionAddress, 'ft', owner, true);
const collectionOwner = await collectionEvm.methods.collectionOwner().call();
expect(helper.address.restoreCrossAccountFromBigInt(BigInt(collectionOwner.sub))).to.eq(helper.address.ethToSubstrate(owner, true));
});
@@ -156,7 +156,7 @@
itEth('(!negative test!) Create collection (bad lengths)', async ({helper}) => {
const owner = await helper.eth.createAccountWithBalance(donor);
- const collectionHelper = await helper.ethNativeContract.collectionHelpers(owner);
+ const collectionHelper = helper.ethNativeContract.collectionHelpers(owner);
{
const MAX_NAME_LENGTH = 64;
const collectionName = 'A'.repeat(MAX_NAME_LENGTH + 1);
@@ -190,7 +190,7 @@
itEth('(!negative test!) Create collection (no funds)', async ({helper}) => {
const owner = await helper.eth.createAccountWithBalance(donor);
- const collectionHelper = await helper.ethNativeContract.collectionHelpers(owner);
+ const collectionHelper = helper.ethNativeContract.collectionHelpers(owner);
await expect(collectionHelper.methods
.createNFTCollection('Peasantry', 'absolutely anything', 'CVE')
.call({value: Number(1n * nominal)})).to.be.rejectedWith('Sent amount not equals to collection creation price (2000000000000000000)');
@@ -209,7 +209,7 @@
.setCollectionSponsor(sponsor)
.call()).to.be.rejectedWith(EXPECTED_ERROR);
- const sponsorCollection = await helper.ethNativeContract.collection(collectionAddress, 'nft', sponsor, true);
+ const sponsorCollection = helper.ethNativeContract.collection(collectionAddress, 'nft', sponsor, true);
await expect(sponsorCollection.methods
.confirmCollectionSponsorship()
.call()).to.be.rejectedWith('ConfirmSponsorshipFail');
@@ -225,7 +225,7 @@
const owner = await helper.eth.createAccountWithBalance(donor);
const malfeasant = helper.eth.createAccount();
const {collectionAddress} = await helper.eth.createNFTCollection(owner, 'Transgressed', 'absolutely anything', 'COR');
- const malfeasantCollection = await helper.ethNativeContract.collection(collectionAddress, 'nft', malfeasant);
+ const malfeasantCollection = helper.ethNativeContract.collection(collectionAddress, 'nft', malfeasant);
const EXPECTED_ERROR = 'NoPermission';
{
const sponsor = await helper.eth.createAccountWithBalance(donor);
@@ -234,7 +234,7 @@
.setCollectionSponsorCross(sponsorCross)
.call()).to.be.rejectedWith(EXPECTED_ERROR);
- const sponsorCollection = await helper.ethNativeContract.collection(collectionAddress, 'nft', sponsor);
+ const sponsorCollection = helper.ethNativeContract.collection(collectionAddress, 'nft', sponsor);
await expect(sponsorCollection.methods
.confirmCollectionSponsorship()
.call()).to.be.rejectedWith('ConfirmSponsorshipFail');
@@ -249,7 +249,7 @@
itEth('destroyCollection', async ({helper}) => {
const owner = await helper.eth.createAccountWithBalance(donor);
const {collectionAddress, collectionId} = await helper.eth.createNFTCollection(owner, 'Limits', 'absolutely anything', 'OLF');
- const collectionHelper = await helper.ethNativeContract.collectionHelpers(owner);
+ const collectionHelper = helper.ethNativeContract.collectionHelpers(owner);
const result = await collectionHelper.methods
tests/src/eth/createRFTCollection.test.tsdiffbeforeafterboth--- a/tests/src/eth/createRFTCollection.test.ts
+++ b/tests/src/eth/createRFTCollection.test.ts
@@ -95,7 +95,7 @@
const ss58Format = helper.chain.getChainProperties().ss58Format;
const {collectionId, collectionAddress} = await helper.eth.createRFTCollection(owner, 'Sponsor', 'absolutely anything', 'ENVY');
- const collection = await helper.ethNativeContract.collection(collectionAddress, 'rft', owner, true);
+ const collection = helper.ethNativeContract.collection(collectionAddress, 'rft', owner, true);
await collection.methods.setCollectionSponsor(sponsor).send();
let data = (await helper.rft.getData(collectionId))!;
@@ -103,7 +103,7 @@
await expect(collection.methods.confirmCollectionSponsorship().call()).to.be.rejectedWith('ConfirmSponsorshipFail');
- const sponsorCollection = await helper.ethNativeContract.collection(collectionAddress, 'rft', sponsor, true);
+ const sponsorCollection = helper.ethNativeContract.collection(collectionAddress, 'rft', sponsor, true);
await sponsorCollection.methods.confirmCollectionSponsorship().send();
data = (await helper.rft.getData(collectionId))!;
@@ -116,7 +116,7 @@
const ss58Format = helper.chain.getChainProperties().ss58Format;
const {collectionId, collectionAddress} = await helper.eth.createRFTCollection(owner, 'Sponsor', 'absolutely anything', 'ENVY');
- const collection = await helper.ethNativeContract.collection(collectionAddress, 'rft', owner);
+ const collection = helper.ethNativeContract.collection(collectionAddress, 'rft', owner);
const sponsorCross = helper.ethCrossAccount.fromAddress(sponsor);
await collection.methods.setCollectionSponsorCross(sponsorCross).send();
@@ -125,7 +125,7 @@
await expect(collection.methods.confirmCollectionSponsorship().call()).to.be.rejectedWith('ConfirmSponsorshipFail');
- const sponsorCollection = await helper.ethNativeContract.collection(collectionAddress, 'rft', sponsor);
+ const sponsorCollection = helper.ethNativeContract.collection(collectionAddress, 'rft', sponsor);
await sponsorCollection.methods.confirmCollectionSponsorship().send();
data = (await helper.rft.getData(collectionId))!;
@@ -135,7 +135,7 @@
itEth('Collection address exist', async ({helper}) => {
const owner = await helper.eth.createAccountWithBalance(donor);
const collectionAddressForNonexistentCollection = '0x17C4E6453CC49AAAAEACA894E6D9683E00112233';
- const collectionHelpers = await helper.ethNativeContract.collectionHelpers(owner);
+ const collectionHelpers = helper.ethNativeContract.collectionHelpers(owner);
expect(await collectionHelpers
.methods.isCollectionExist(collectionAddressForNonexistentCollection).call())
@@ -147,7 +147,7 @@
.to.be.true;
// check collectionOwner:
- const collectionEvm = await helper.ethNativeContract.collection(collectionAddress, 'ft', owner, true);
+ const collectionEvm = helper.ethNativeContract.collection(collectionAddress, 'ft', owner, true);
const collectionOwner = await collectionEvm.methods.collectionOwner().call();
expect(helper.address.restoreCrossAccountFromBigInt(BigInt(collectionOwner.sub))).to.eq(helper.address.ethToSubstrate(owner, true));
});
@@ -167,7 +167,7 @@
itEth('(!negative test!) Create collection (bad lengths)', async ({helper}) => {
const owner = await helper.eth.createAccountWithBalance(donor);
- const collectionHelper = await helper.ethNativeContract.collectionHelpers(owner);
+ const collectionHelper = helper.ethNativeContract.collectionHelpers(owner);
{
const MAX_NAME_LENGTH = 64;
const collectionName = 'A'.repeat(MAX_NAME_LENGTH + 1);
@@ -200,7 +200,7 @@
itEth('(!negative test!) Create collection (no funds)', async ({helper}) => {
const owner = await helper.eth.createAccountWithBalance(donor);
- const collectionHelper = await helper.ethNativeContract.collectionHelpers(owner);
+ const collectionHelper = helper.ethNativeContract.collectionHelpers(owner);
await expect(collectionHelper.methods
.createRFTCollection('Peasantry', 'absolutely anything', 'TWIW')
.call({value: Number(1n * nominal)})).to.be.rejectedWith('Sent amount not equals to collection creation price (2000000000000000000)');
@@ -211,7 +211,7 @@
const owner = await helper.eth.createAccountWithBalance(donor);
const peasant = helper.eth.createAccount();
const {collectionAddress} = await helper.eth.createRFTCollection(owner, 'Transgressed', 'absolutely anything', 'YVNE');
- const peasantCollection = await helper.ethNativeContract.collection(collectionAddress, 'rft', peasant, true);
+ const peasantCollection = helper.ethNativeContract.collection(collectionAddress, 'rft', peasant, true);
const EXPECTED_ERROR = 'NoPermission';
{
const sponsor = await helper.eth.createAccountWithBalance(donor);
@@ -219,7 +219,7 @@
.setCollectionSponsor(sponsor)
.call()).to.be.rejectedWith(EXPECTED_ERROR);
- const sponsorCollection = await helper.ethNativeContract.collection(collectionAddress, 'rft', sponsor, true);
+ const sponsorCollection = helper.ethNativeContract.collection(collectionAddress, 'rft', sponsor, true);
await expect(sponsorCollection.methods
.confirmCollectionSponsorship()
.call()).to.be.rejectedWith('ConfirmSponsorshipFail');
@@ -235,7 +235,7 @@
const owner = await helper.eth.createAccountWithBalance(donor);
const peasant = helper.eth.createAccount();
const {collectionAddress} = await helper.eth.createRFTCollection(owner, 'Transgressed', 'absolutely anything', 'YVNE');
- const peasantCollection = await helper.ethNativeContract.collection(collectionAddress, 'rft', peasant);
+ const peasantCollection = helper.ethNativeContract.collection(collectionAddress, 'rft', peasant);
const EXPECTED_ERROR = 'NoPermission';
{
const sponsor = await helper.eth.createAccountWithBalance(donor);
@@ -244,7 +244,7 @@
.setCollectionSponsorCross(sponsorCross)
.call()).to.be.rejectedWith(EXPECTED_ERROR);
- const sponsorCollection = await helper.ethNativeContract.collection(collectionAddress, 'rft', sponsor);
+ const sponsorCollection = helper.ethNativeContract.collection(collectionAddress, 'rft', sponsor);
await expect(sponsorCollection.methods
.confirmCollectionSponsorship()
.call()).to.be.rejectedWith('ConfirmSponsorshipFail');
@@ -259,7 +259,7 @@
itEth('destroyCollection', async ({helper}) => {
const owner = await helper.eth.createAccountWithBalance(donor);
const {collectionAddress, collectionId} = await helper.eth.createRFTCollection(owner, 'Limits', 'absolutely anything', 'OLF');
- const collectionHelper = await helper.ethNativeContract.collectionHelpers(owner);
+ const collectionHelper = helper.ethNativeContract.collectionHelpers(owner);
await expect(collectionHelper.methods
.destroyCollection(collectionAddress)
tests/src/eth/util/playgrounds/unique.dev.tsdiffbeforeafterboth--- a/tests/src/eth/util/playgrounds/unique.dev.ts
+++ b/tests/src/eth/util/playgrounds/unique.dev.ts
@@ -207,7 +207,7 @@
}
private async createTransaction() {
- const collectionHelper = await this.helper.ethNativeContract.collectionHelpers(this.signer);
+ const collectionHelper = this.helper.ethNativeContract.collectionHelpers(this.signer);
let collectionMode;
switch (this.data.collectionMode) {
case 'nft': collectionMode = CollectionMode.Nonfungible; break;
tests/src/util/index.tsdiffbeforeafterboth--- a/tests/src/util/index.ts
+++ b/tests/src/util/index.ts
@@ -15,6 +15,7 @@
import {dirname} from 'path';
import {fileURLToPath} from 'url';
+chai.config.truncateThreshold = 0;
chai.use(chaiAsPromised);
chai.use(chaiSubset);
export const expect = chai.expect;
tests/src/util/playgrounds/unique.dev.tsdiffbeforeafterboth--- a/tests/src/util/playgrounds/unique.dev.ts
+++ b/tests/src/util/playgrounds/unique.dev.ts
@@ -41,7 +41,9 @@
for(const arg of args) {
if(typeof arg !== 'string')
continue;
- if(arg.includes('1000:: Normal connection closure') || arg.includes('Not decorating unknown runtime apis:') || arg.includes('RPC methods not decorated:') || arg === 'Normal connection closure')
+ const skippedWarnings = ['1000:: Normal connection closure', 'Not decorating unknown runtime apis:', 'RPC methods not decorated:', 'Not decorating runtime apis'];
+ const needToSkip = skippedWarnings.reduce((a, b) => a || arg.includes(b), false);
+ if(needToSkip || arg === 'Normal connection closure')
return;
}
printer(...args);