1234567891011121314151617import {IKeyringPair} from '@polkadot/types/types';18import {Pallets} from '../util';19import {expect, itEth, usingEthPlaygrounds} from './util';2021describe('Destroy Collection from EVM', function() {22 let donor: IKeyringPair;23 const testCases = [24 {method: 'createRFTCollection' as const, params: ['Limits', 'absolutely anything', 'OLF'], requiredPallets: [Pallets.ReFungible]},25 {method: 'createNFTCollection' as const, params: ['Limits', 'absolutely anything', 'OLF'], requiredPallets: [Pallets.NFT]},26 {method: 'createFTCollection' as const, params: ['Limits', 'absolutely anything', 'OLF', 18], requiredPallets: [Pallets.Fungible]},27 ];2829 before(async function() {30 await usingEthPlaygrounds(async (_, privateKey) => {31 donor = await privateKey({filename: __filename});32 });33 });3435 testCases.map((testCase) => 36 itEth.ifWithPallets(`Cannot burn non-owned or non-existing collection ${testCase.method}`, testCase.requiredPallets, async ({helper}) => {37 const owner = await helper.eth.createAccountWithBalance(donor);38 const signer = await helper.eth.createAccountWithBalance(donor);39 40 const unexistedCollection = helper.ethAddress.fromCollectionId(1000000);41 42 const collectionHelpers = helper.ethNativeContract.collectionHelpers(signer);43 const {collectionAddress} = await helper.eth.createCollecion(testCase.method, owner, ...testCase.params as [string, string, string, number?]);4445 46 await expect(collectionHelpers.methods47 .destroyCollection(collectionAddress)48 .send({from: signer})).to.be.rejected;49 50 await expect(collectionHelpers.methods51 .destroyCollection(unexistedCollection)52 .send({from: signer})).to.be.rejected;53 54 expect(await collectionHelpers.methods55 .isCollectionExist(unexistedCollection)56 .call()).to.be.false;57 58 expect(await collectionHelpers.methods59 .isCollectionExist(collectionAddress)60 .call()).to.be.true;61 }));62});