123456789101112131415161718import {ApiPromise} from '@polkadot/api';19import {IKeyringPair} from '@polkadot/types/types';20import chai from 'chai';21import chaiAsPromised from 'chai-as-promised';22import privateKey from '../substrate/privateKey';23import usingApi, {submitTransactionAsync} from '../substrate/substrate-api';24import {uniqueEventMessage} from '../util/helpers';2526chai.use(chaiAsPromised);27const expect = chai.expect;2829describe('Create collection event ', () => {30 let alice: IKeyringPair;31 const checkSection = 'CollectionCreated';32 const checkTreasury = 'Deposit';33 const checkSystem = 'ExtrinsicSuccess';34 before(async () => {35 await usingApi(async () => {36 alice = privateKey('//Alice');37 });38 });39 it('Check event from createCollection(): ', async () => {40 await usingApi(async (api: ApiPromise) => {41 const tx = api.tx.unique.createCollectionEx({name: [0x31], description: [0x32], tokenPrefix: '0x33', mode: 'NFT'});42 const events = await submitTransactionAsync(alice, tx);43 const msg = JSON.stringify(uniqueEventMessage(events));44 expect(msg).to.be.contain(checkSection);45 expect(msg).to.be.contain(checkTreasury);46 expect(msg).to.be.contain(checkSystem);47 });48 });49});