difftreelog
Fix tests: lost await
in: master
3 files changed
tests/src/eth/createFTCollection.test.tsdiffbeforeafterboth--- a/tests/src/eth/createFTCollection.test.ts
+++ b/tests/src/eth/createFTCollection.test.ts
@@ -96,7 +96,7 @@
.to.be.true;
// check collectionOwner:
- const collectionEvm = helper.ethNativeContract.collection(collectionAddress, 'ft', owner, true);
+ const collectionEvm = await 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));
});
tests/src/eth/createNFTCollection.test.tsdiffbeforeafterboth--- a/tests/src/eth/createNFTCollection.test.ts
+++ b/tests/src/eth/createNFTCollection.test.ts
@@ -136,7 +136,7 @@
.to.be.true;
// check collectionOwner:
- const collectionEvm = helper.ethNativeContract.collection(collectionAddress, 'ft', owner, true);
+ const collectionEvm = await 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));
});
tests/src/eth/createRFTCollection.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.8//9// 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 {evmToAddress} from '@polkadot/util-crypto';18import {IKeyringPair} from '@polkadot/types/types';19import {Pallets, requirePalletsOrSkip} from '../util';20import {expect, itEth, usingEthPlaygrounds} from './util';21import {CollectionLimits} from './util/playgrounds/types';222324describe('Create RFT collection from EVM', () => {25 let donor: IKeyringPair;2627 before(async function() {28 await usingEthPlaygrounds(async (helper, privateKey) => {29 requirePalletsOrSkip(this, helper, [Pallets.ReFungible]);30 donor = await privateKey({filename: __filename});31 });32 });3334 itEth('Create collection', async ({helper}) => {35 const owner = await helper.eth.createAccountWithBalance(donor);3637 const name = 'CollectionEVM';38 const description = 'Some description';39 const prefix = 'token prefix';4041 const {collectionId} = await helper.eth.createRFTCollection(owner, name, description, prefix);42 const data = (await helper.rft.getData(collectionId))!;43 const collection = helper.rft.getCollectionObject(collectionId);4445 expect(data.name).to.be.eq(name);46 expect(data.description).to.be.eq(description);47 expect(data.raw.tokenPrefix).to.be.eq(prefix);48 expect(data.raw.mode).to.be.eq('ReFungible');4950 const options = await collection.getOptions();5152 expect(options.tokenPropertyPermissions).to.be.empty;53 });54555657 itEth('Create collection with properties & get description', async ({helper}) => {58 const owner = await helper.eth.createAccountWithBalance(donor);5960 const name = 'CollectionEVM';61 const description = 'Some description';62 const prefix = 'token prefix';63 const baseUri = 'BaseURI';6465 const {collectionId, collectionAddress} = await helper.eth.createERC721MetadataCompatibleRFTCollection(owner, name, description, prefix, baseUri);66 const contract = await helper.ethNativeContract.collection(collectionAddress, 'nft');6768 const collection = helper.rft.getCollectionObject(collectionId);69 const data = (await collection.getData())!;7071 expect(data.name).to.be.eq(name);72 expect(data.description).to.be.eq(description);73 expect(data.raw.tokenPrefix).to.be.eq(prefix);74 expect(data.raw.mode).to.be.eq('ReFungible');7576 expect(await contract.methods.description().call()).to.deep.equal(description);7778 const options = await collection.getOptions();79 expect(options.tokenPropertyPermissions).to.be.deep.equal([80 {81 key: 'URI',82 permission: {mutable: true, collectionAdmin: true, tokenOwner: false},83 },84 {85 key: 'URISuffix',86 permission: {mutable: true, collectionAdmin: true, tokenOwner: false},87 },88 ]);89 });9091 // Soft-deprecated92 itEth('[eth] Set sponsorship', async ({helper}) => {93 const owner = await helper.eth.createAccountWithBalance(donor);94 const sponsor = await helper.eth.createAccountWithBalance(donor);95 const ss58Format = helper.chain.getChainProperties().ss58Format;96 const {collectionId, collectionAddress} = await helper.eth.createRFTCollection(owner, 'Sponsor', 'absolutely anything', 'ENVY');9798 const collection = await helper.ethNativeContract.collection(collectionAddress, 'rft', owner, true);99 await collection.methods.setCollectionSponsor(sponsor).send();100101 let data = (await helper.rft.getData(collectionId))!;102 expect(data.raw.sponsorship.Unconfirmed).to.be.equal(evmToAddress(sponsor, Number(ss58Format)));103104 await expect(collection.methods.confirmCollectionSponsorship().call()).to.be.rejectedWith('ConfirmSponsorshipFail');105106 const sponsorCollection = await helper.ethNativeContract.collection(collectionAddress, 'rft', sponsor, true);107 await sponsorCollection.methods.confirmCollectionSponsorship().send();108109 data = (await helper.rft.getData(collectionId))!;110 expect(data.raw.sponsorship.Confirmed).to.be.equal(evmToAddress(sponsor, Number(ss58Format)));111 });112113 itEth('[cross] Set sponsorship', async ({helper}) => {114 const owner = await helper.eth.createAccountWithBalance(donor);115 const sponsor = await helper.eth.createAccountWithBalance(donor);116 const ss58Format = helper.chain.getChainProperties().ss58Format;117 const {collectionId, collectionAddress} = await helper.eth.createRFTCollection(owner, 'Sponsor', 'absolutely anything', 'ENVY');118119 const collection = await helper.ethNativeContract.collection(collectionAddress, 'rft', owner);120 const sponsorCross = helper.ethCrossAccount.fromAddress(sponsor);121 await collection.methods.setCollectionSponsorCross(sponsorCross).send();122123 let data = (await helper.rft.getData(collectionId))!;124 expect(data.raw.sponsorship.Unconfirmed).to.be.equal(evmToAddress(sponsor, Number(ss58Format)));125126 await expect(collection.methods.confirmCollectionSponsorship().call()).to.be.rejectedWith('ConfirmSponsorshipFail');127128 const sponsorCollection = await helper.ethNativeContract.collection(collectionAddress, 'rft', sponsor);129 await sponsorCollection.methods.confirmCollectionSponsorship().send();130131 data = (await helper.rft.getData(collectionId))!;132 expect(data.raw.sponsorship.Confirmed).to.be.equal(evmToAddress(sponsor, Number(ss58Format)));133 });134135 itEth('Collection address exist', async ({helper}) => {136 const owner = await helper.eth.createAccountWithBalance(donor);137 const collectionAddressForNonexistentCollection = '0x17C4E6453CC49AAAAEACA894E6D9683E00112233';138 const collectionHelpers = await helper.ethNativeContract.collectionHelpers(owner);139140 expect(await collectionHelpers141 .methods.isCollectionExist(collectionAddressForNonexistentCollection).call())142 .to.be.false;143144 const {collectionAddress} = await helper.eth.createRFTCollection(owner, 'Exister', 'absolutely anything', 'WIWT');145 expect(await collectionHelpers146 .methods.isCollectionExist(collectionAddress).call())147 .to.be.true;148149 // check collectionOwner:150 const collectionEvm = helper.ethNativeContract.collection(collectionAddress, 'ft', owner, true);151 const collectionOwner = await collectionEvm.methods.collectionOwner().call();152 expect(helper.address.restoreCrossAccountFromBigInt(BigInt(collectionOwner.sub))).to.eq(helper.address.ethToSubstrate(owner));153 });154});155156describe('(!negative tests!) Create RFT collection from EVM', () => {157 let donor: IKeyringPair;158 let nominal: bigint;159160 before(async function() {161 await usingEthPlaygrounds(async (helper, privateKey) => {162 requirePalletsOrSkip(this, helper, [Pallets.ReFungible]);163 donor = await privateKey({filename: __filename});164 nominal = helper.balance.getOneTokenNominal();165 });166 });167168 itEth('(!negative test!) Create collection (bad lengths)', async ({helper}) => {169 const owner = await helper.eth.createAccountWithBalance(donor);170 const collectionHelper = await helper.ethNativeContract.collectionHelpers(owner);171 {172 const MAX_NAME_LENGTH = 64;173 const collectionName = 'A'.repeat(MAX_NAME_LENGTH + 1);174 const description = 'A';175 const tokenPrefix = 'A';176177 await expect(collectionHelper.methods178 .createRFTCollection(collectionName, description, tokenPrefix)179 .call({value: Number(2n * nominal)})).to.be.rejectedWith('name is too long. Max length is ' + MAX_NAME_LENGTH);180 }181 {182 const MAX_DESCRIPTION_LENGTH = 256;183 const collectionName = 'A';184 const description = 'A'.repeat(MAX_DESCRIPTION_LENGTH + 1);185 const tokenPrefix = 'A';186 await expect(collectionHelper.methods187 .createRFTCollection(collectionName, description, tokenPrefix)188 .call({value: Number(2n * nominal)})).to.be.rejectedWith('description is too long. Max length is ' + MAX_DESCRIPTION_LENGTH);189 }190 {191 const MAX_TOKEN_PREFIX_LENGTH = 16;192 const collectionName = 'A';193 const description = 'A';194 const tokenPrefix = 'A'.repeat(MAX_TOKEN_PREFIX_LENGTH + 1);195 await expect(collectionHelper.methods196 .createRFTCollection(collectionName, description, tokenPrefix)197 .call({value: Number(2n * nominal)})).to.be.rejectedWith('token_prefix is too long. Max length is ' + MAX_TOKEN_PREFIX_LENGTH);198 }199 });200201 itEth('(!negative test!) Create collection (no funds)', async ({helper}) => {202 const owner = await helper.eth.createAccountWithBalance(donor);203 const collectionHelper = await helper.ethNativeContract.collectionHelpers(owner);204 await expect(collectionHelper.methods205 .createRFTCollection('Peasantry', 'absolutely anything', 'TWIW')206 .call({value: Number(1n * nominal)})).to.be.rejectedWith('Sent amount not equals to collection creation price (2000000000000000000)');207 });208209 // Soft-deprecated210 itEth('(!negative test!) [eth] Check owner', async ({helper}) => {211 const owner = await helper.eth.createAccountWithBalance(donor);212 const peasant = helper.eth.createAccount();213 const {collectionAddress} = await helper.eth.createRFTCollection(owner, 'Transgressed', 'absolutely anything', 'YVNE');214 const peasantCollection = await helper.ethNativeContract.collection(collectionAddress, 'rft', peasant, true);215 const EXPECTED_ERROR = 'NoPermission';216 {217 const sponsor = await helper.eth.createAccountWithBalance(donor);218 await expect(peasantCollection.methods219 .setCollectionSponsor(sponsor)220 .call()).to.be.rejectedWith(EXPECTED_ERROR);221222 const sponsorCollection = await helper.ethNativeContract.collection(collectionAddress, 'rft', sponsor, true);223 await expect(sponsorCollection.methods224 .confirmCollectionSponsorship()225 .call()).to.be.rejectedWith('ConfirmSponsorshipFail');226 }227 {228 await expect(peasantCollection.methods229 .setCollectionLimit(CollectionLimits.AccountTokenOwnership, true, 1000)230 .call()).to.be.rejectedWith(EXPECTED_ERROR);231 }232 });233234 itEth('(!negative test!) [cross] Check owner', async ({helper}) => {235 const owner = await helper.eth.createAccountWithBalance(donor);236 const peasant = helper.eth.createAccount();237 const {collectionAddress} = await helper.eth.createRFTCollection(owner, 'Transgressed', 'absolutely anything', 'YVNE');238 const peasantCollection = await helper.ethNativeContract.collection(collectionAddress, 'rft', peasant);239 const EXPECTED_ERROR = 'NoPermission';240 {241 const sponsor = await helper.eth.createAccountWithBalance(donor);242 const sponsorCross = helper.ethCrossAccount.fromAddress(sponsor);243 await expect(peasantCollection.methods244 .setCollectionSponsorCross(sponsorCross)245 .call()).to.be.rejectedWith(EXPECTED_ERROR);246247 const sponsorCollection = await helper.ethNativeContract.collection(collectionAddress, 'rft', sponsor);248 await expect(sponsorCollection.methods249 .confirmCollectionSponsorship()250 .call()).to.be.rejectedWith('ConfirmSponsorshipFail');251 }252 {253 await expect(peasantCollection.methods254 .setCollectionLimit(CollectionLimits.AccountTokenOwnership, true, 1000)255 .call()).to.be.rejectedWith(EXPECTED_ERROR);256 }257 });258259 itEth('destroyCollection', async ({helper}) => {260 const owner = await helper.eth.createAccountWithBalance(donor);261 const {collectionAddress, collectionId} = await helper.eth.createRFTCollection(owner, 'Limits', 'absolutely anything', 'OLF');262 const collectionHelper = await helper.ethNativeContract.collectionHelpers(owner);263264 await expect(collectionHelper.methods265 .destroyCollection(collectionAddress)266 .send({from: owner})).to.be.fulfilled;267268 expect(await collectionHelper.methods269 .isCollectionExist(collectionAddress)270 .call()).to.be.false;271 expect(await helper.collection.getData(collectionId)).to.be.null;272 });273});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.8//9// 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 {evmToAddress} from '@polkadot/util-crypto';18import {IKeyringPair} from '@polkadot/types/types';19import {Pallets, requirePalletsOrSkip} from '../util';20import {expect, itEth, usingEthPlaygrounds} from './util';21import {CollectionLimits} from './util/playgrounds/types';222324describe('Create RFT collection from EVM', () => {25 let donor: IKeyringPair;2627 before(async function() {28 await usingEthPlaygrounds(async (helper, privateKey) => {29 requirePalletsOrSkip(this, helper, [Pallets.ReFungible]);30 donor = await privateKey({filename: __filename});31 });32 });3334 itEth('Create collection', async ({helper}) => {35 const owner = await helper.eth.createAccountWithBalance(donor);3637 const name = 'CollectionEVM';38 const description = 'Some description';39 const prefix = 'token prefix';4041 const {collectionId} = await helper.eth.createRFTCollection(owner, name, description, prefix);42 const data = (await helper.rft.getData(collectionId))!;43 const collection = helper.rft.getCollectionObject(collectionId);4445 expect(data.name).to.be.eq(name);46 expect(data.description).to.be.eq(description);47 expect(data.raw.tokenPrefix).to.be.eq(prefix);48 expect(data.raw.mode).to.be.eq('ReFungible');4950 const options = await collection.getOptions();5152 expect(options.tokenPropertyPermissions).to.be.empty;53 });54555657 itEth('Create collection with properties & get description', async ({helper}) => {58 const owner = await helper.eth.createAccountWithBalance(donor);5960 const name = 'CollectionEVM';61 const description = 'Some description';62 const prefix = 'token prefix';63 const baseUri = 'BaseURI';6465 const {collectionId, collectionAddress} = await helper.eth.createERC721MetadataCompatibleRFTCollection(owner, name, description, prefix, baseUri);66 const contract = await helper.ethNativeContract.collection(collectionAddress, 'nft');6768 const collection = helper.rft.getCollectionObject(collectionId);69 const data = (await collection.getData())!;7071 expect(data.name).to.be.eq(name);72 expect(data.description).to.be.eq(description);73 expect(data.raw.tokenPrefix).to.be.eq(prefix);74 expect(data.raw.mode).to.be.eq('ReFungible');7576 expect(await contract.methods.description().call()).to.deep.equal(description);7778 const options = await collection.getOptions();79 expect(options.tokenPropertyPermissions).to.be.deep.equal([80 {81 key: 'URI',82 permission: {mutable: true, collectionAdmin: true, tokenOwner: false},83 },84 {85 key: 'URISuffix',86 permission: {mutable: true, collectionAdmin: true, tokenOwner: false},87 },88 ]);89 });9091 // Soft-deprecated92 itEth('[eth] Set sponsorship', async ({helper}) => {93 const owner = await helper.eth.createAccountWithBalance(donor);94 const sponsor = await helper.eth.createAccountWithBalance(donor);95 const ss58Format = helper.chain.getChainProperties().ss58Format;96 const {collectionId, collectionAddress} = await helper.eth.createRFTCollection(owner, 'Sponsor', 'absolutely anything', 'ENVY');9798 const collection = await helper.ethNativeContract.collection(collectionAddress, 'rft', owner, true);99 await collection.methods.setCollectionSponsor(sponsor).send();100101 let data = (await helper.rft.getData(collectionId))!;102 expect(data.raw.sponsorship.Unconfirmed).to.be.equal(evmToAddress(sponsor, Number(ss58Format)));103104 await expect(collection.methods.confirmCollectionSponsorship().call()).to.be.rejectedWith('ConfirmSponsorshipFail');105106 const sponsorCollection = await helper.ethNativeContract.collection(collectionAddress, 'rft', sponsor, true);107 await sponsorCollection.methods.confirmCollectionSponsorship().send();108109 data = (await helper.rft.getData(collectionId))!;110 expect(data.raw.sponsorship.Confirmed).to.be.equal(evmToAddress(sponsor, Number(ss58Format)));111 });112113 itEth('[cross] Set sponsorship', async ({helper}) => {114 const owner = await helper.eth.createAccountWithBalance(donor);115 const sponsor = await helper.eth.createAccountWithBalance(donor);116 const ss58Format = helper.chain.getChainProperties().ss58Format;117 const {collectionId, collectionAddress} = await helper.eth.createRFTCollection(owner, 'Sponsor', 'absolutely anything', 'ENVY');118119 const collection = await helper.ethNativeContract.collection(collectionAddress, 'rft', owner);120 const sponsorCross = helper.ethCrossAccount.fromAddress(sponsor);121 await collection.methods.setCollectionSponsorCross(sponsorCross).send();122123 let data = (await helper.rft.getData(collectionId))!;124 expect(data.raw.sponsorship.Unconfirmed).to.be.equal(evmToAddress(sponsor, Number(ss58Format)));125126 await expect(collection.methods.confirmCollectionSponsorship().call()).to.be.rejectedWith('ConfirmSponsorshipFail');127128 const sponsorCollection = await helper.ethNativeContract.collection(collectionAddress, 'rft', sponsor);129 await sponsorCollection.methods.confirmCollectionSponsorship().send();130131 data = (await helper.rft.getData(collectionId))!;132 expect(data.raw.sponsorship.Confirmed).to.be.equal(evmToAddress(sponsor, Number(ss58Format)));133 });134135 itEth('Collection address exist', async ({helper}) => {136 const owner = await helper.eth.createAccountWithBalance(donor);137 const collectionAddressForNonexistentCollection = '0x17C4E6453CC49AAAAEACA894E6D9683E00112233';138 const collectionHelpers = await helper.ethNativeContract.collectionHelpers(owner);139140 expect(await collectionHelpers141 .methods.isCollectionExist(collectionAddressForNonexistentCollection).call())142 .to.be.false;143144 const {collectionAddress} = await helper.eth.createRFTCollection(owner, 'Exister', 'absolutely anything', 'WIWT');145 expect(await collectionHelpers146 .methods.isCollectionExist(collectionAddress).call())147 .to.be.true;148149 // check collectionOwner:150 const collectionEvm = await helper.ethNativeContract.collection(collectionAddress, 'ft', owner, true);151 const collectionOwner = await collectionEvm.methods.collectionOwner().call();152 expect(helper.address.restoreCrossAccountFromBigInt(BigInt(collectionOwner.sub))).to.eq(helper.address.ethToSubstrate(owner));153 });154});155156describe('(!negative tests!) Create RFT collection from EVM', () => {157 let donor: IKeyringPair;158 let nominal: bigint;159160 before(async function() {161 await usingEthPlaygrounds(async (helper, privateKey) => {162 requirePalletsOrSkip(this, helper, [Pallets.ReFungible]);163 donor = await privateKey({filename: __filename});164 nominal = helper.balance.getOneTokenNominal();165 });166 });167168 itEth('(!negative test!) Create collection (bad lengths)', async ({helper}) => {169 const owner = await helper.eth.createAccountWithBalance(donor);170 const collectionHelper = await helper.ethNativeContract.collectionHelpers(owner);171 {172 const MAX_NAME_LENGTH = 64;173 const collectionName = 'A'.repeat(MAX_NAME_LENGTH + 1);174 const description = 'A';175 const tokenPrefix = 'A';176177 await expect(collectionHelper.methods178 .createRFTCollection(collectionName, description, tokenPrefix)179 .call({value: Number(2n * nominal)})).to.be.rejectedWith('name is too long. Max length is ' + MAX_NAME_LENGTH);180 }181 {182 const MAX_DESCRIPTION_LENGTH = 256;183 const collectionName = 'A';184 const description = 'A'.repeat(MAX_DESCRIPTION_LENGTH + 1);185 const tokenPrefix = 'A';186 await expect(collectionHelper.methods187 .createRFTCollection(collectionName, description, tokenPrefix)188 .call({value: Number(2n * nominal)})).to.be.rejectedWith('description is too long. Max length is ' + MAX_DESCRIPTION_LENGTH);189 }190 {191 const MAX_TOKEN_PREFIX_LENGTH = 16;192 const collectionName = 'A';193 const description = 'A';194 const tokenPrefix = 'A'.repeat(MAX_TOKEN_PREFIX_LENGTH + 1);195 await expect(collectionHelper.methods196 .createRFTCollection(collectionName, description, tokenPrefix)197 .call({value: Number(2n * nominal)})).to.be.rejectedWith('token_prefix is too long. Max length is ' + MAX_TOKEN_PREFIX_LENGTH);198 }199 });200201 itEth('(!negative test!) Create collection (no funds)', async ({helper}) => {202 const owner = await helper.eth.createAccountWithBalance(donor);203 const collectionHelper = await helper.ethNativeContract.collectionHelpers(owner);204 await expect(collectionHelper.methods205 .createRFTCollection('Peasantry', 'absolutely anything', 'TWIW')206 .call({value: Number(1n * nominal)})).to.be.rejectedWith('Sent amount not equals to collection creation price (2000000000000000000)');207 });208209 // Soft-deprecated210 itEth('(!negative test!) [eth] Check owner', async ({helper}) => {211 const owner = await helper.eth.createAccountWithBalance(donor);212 const peasant = helper.eth.createAccount();213 const {collectionAddress} = await helper.eth.createRFTCollection(owner, 'Transgressed', 'absolutely anything', 'YVNE');214 const peasantCollection = await helper.ethNativeContract.collection(collectionAddress, 'rft', peasant, true);215 const EXPECTED_ERROR = 'NoPermission';216 {217 const sponsor = await helper.eth.createAccountWithBalance(donor);218 await expect(peasantCollection.methods219 .setCollectionSponsor(sponsor)220 .call()).to.be.rejectedWith(EXPECTED_ERROR);221222 const sponsorCollection = await helper.ethNativeContract.collection(collectionAddress, 'rft', sponsor, true);223 await expect(sponsorCollection.methods224 .confirmCollectionSponsorship()225 .call()).to.be.rejectedWith('ConfirmSponsorshipFail');226 }227 {228 await expect(peasantCollection.methods229 .setCollectionLimit(CollectionLimits.AccountTokenOwnership, true, 1000)230 .call()).to.be.rejectedWith(EXPECTED_ERROR);231 }232 });233234 itEth('(!negative test!) [cross] Check owner', async ({helper}) => {235 const owner = await helper.eth.createAccountWithBalance(donor);236 const peasant = helper.eth.createAccount();237 const {collectionAddress} = await helper.eth.createRFTCollection(owner, 'Transgressed', 'absolutely anything', 'YVNE');238 const peasantCollection = await helper.ethNativeContract.collection(collectionAddress, 'rft', peasant);239 const EXPECTED_ERROR = 'NoPermission';240 {241 const sponsor = await helper.eth.createAccountWithBalance(donor);242 const sponsorCross = helper.ethCrossAccount.fromAddress(sponsor);243 await expect(peasantCollection.methods244 .setCollectionSponsorCross(sponsorCross)245 .call()).to.be.rejectedWith(EXPECTED_ERROR);246247 const sponsorCollection = await helper.ethNativeContract.collection(collectionAddress, 'rft', sponsor);248 await expect(sponsorCollection.methods249 .confirmCollectionSponsorship()250 .call()).to.be.rejectedWith('ConfirmSponsorshipFail');251 }252 {253 await expect(peasantCollection.methods254 .setCollectionLimit(CollectionLimits.AccountTokenOwnership, true, 1000)255 .call()).to.be.rejectedWith(EXPECTED_ERROR);256 }257 });258259 itEth('destroyCollection', async ({helper}) => {260 const owner = await helper.eth.createAccountWithBalance(donor);261 const {collectionAddress, collectionId} = await helper.eth.createRFTCollection(owner, 'Limits', 'absolutely anything', 'OLF');262 const collectionHelper = await helper.ethNativeContract.collectionHelpers(owner);263264 await expect(collectionHelper.methods265 .destroyCollection(collectionAddress)266 .send({from: owner})).to.be.fulfilled;267268 expect(await collectionHelper.methods269 .isCollectionExist(collectionAddress)270 .call()).to.be.false;271 expect(await helper.collection.getData(collectionId)).to.be.null;272 });273});