1234567891011121314151617import type {IKeyringPair} from '@polkadot/types/types';18import {Pallets} from '@unique/test-utils/util.js';19import {expect, itEth, usingEthPlaygrounds} from './util/index.js';20import type {TCollectionMode} from '@unique-nft/playgrounds/types.js';21import {CreateCollectionData} from './util/playgrounds/types.js';2223describe('Destroy Collection from EVM', function() {24 let donor: IKeyringPair;25 const testCases = [26 {case: 'rft' as const, params: ['Limits', 'absolutely anything', 'OLF', 'rft'], requiredPallets: [Pallets.ReFungible]},27 {case: 'nft' as const, params: ['Limits', 'absolutely anything', 'OLF', 'nft'], requiredPallets: [Pallets.NFT]},28 {case: 'ft' as const, params: ['Limits', 'absolutely anything', 'OLF', 'ft', 18], requiredPallets: [Pallets.Fungible]},29 ];3031 before(async function() {32 await usingEthPlaygrounds(async (_, privateKey) => {33 donor = await privateKey({url: import.meta.url});34 });35 });3637 testCases.map((testCase) =>38 itEth.ifWithPallets(`Cannot burn non-owned or non-existing collection ${testCase.case}`, testCase.requiredPallets, async ({helper}) => {39 const owner = await helper.eth.createAccountWithBalance(donor);40 const signer = await helper.eth.createAccountWithBalance(donor);4142 const unexistedCollection = helper.ethAddress.fromCollectionId(1000000);4344 const collectionHelpers = await helper.ethNativeContract.collectionHelpers(signer);45 const {collectionAddress} = await helper.eth.createCollection(owner, new CreateCollectionData(...testCase.params as [string, string, string, TCollectionMode, number?])).send();46 47 await expect(collectionHelpers.methods48 .destroyCollection(collectionAddress)49 .send({from: signer})).to.be.rejected;5051 await expect(collectionHelpers.methods52 .destroyCollection(unexistedCollection)53 .send({from: signer})).to.be.rejected;5455 expect(await collectionHelpers.methods56 .isCollectionExist(unexistedCollection)57 .call()).to.be.false;5859 expect(await collectionHelpers.methods60 .isCollectionExist(collectionAddress)61 .call()).to.be.true;62 }));63});