1234567891011121314151617import {expect} from 'chai';18import {getCreatedCollectionCount, getDetailedCollectionInfo} from '../util/helpers';19import {collectionHelper, collectionIdFromAddress, contractHelpers, createEthAccountWithBalance, itWeb3} from './util/helpers';2021describe('Create collection from EVM', () => {22 itWeb3('Create collection', async ({api, web3}) => {23 const owner = await createEthAccountWithBalance(api, web3);24 const helpers = collectionHelper(web3, owner);25 const collectionName = 'CollectionEVM';26 const description = 'Some description';27 const tokenPrefix = 'token prefix';28 29 const collectionCountBefore = await getCreatedCollectionCount(api);30 const result = await helpers.methods31 .create721Collection(collectionName, description, tokenPrefix)32 .send();33 const collectionCountAfter = await getCreatedCollectionCount(api);34 35 const collectionId = collectionIdFromAddress(result.events[0].raw.topics[2]);36 expect(collectionCountAfter - collectionCountBefore).to.be.eq(1);37 expect(collectionId).to.be.eq(collectionCountAfter);38 39 const collection = (await getDetailedCollectionInfo(api, collectionId))!;40 expect(collection.name.map(v => String.fromCharCode(v.toNumber())).join('')).to.be.eq(collectionName);41 expect(collection.description.map(v => String.fromCharCode(v.toNumber())).join('')).to.be.eq(description);42 expect(collection.tokenPrefix.toHuman()).to.be.eq(tokenPrefix);43 expect(collection.schemaVersion.type).to.be.eq('ImageURL');44 });45});