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 {createCollectionExpectSuccess, uniqueEventMessage, normalizeAccountId} from '../util/helpers';2526chai.use(chaiAsPromised);27const expect = chai.expect;2829describe('Create Multiple Items Event event ', () => {30 let alice: IKeyringPair;31 const checkSection = 'ItemCreated';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 createMultipleItems(): ', async () => {40 await usingApi(async (api: ApiPromise) => {41 const collectionID = await createCollectionExpectSuccess();42 const args = [{NFT: {}}, {NFT: {}}, {NFT: {}}];43 const createMultipleItems = api.tx.unique.createMultipleItems(collectionID, normalizeAccountId(alice.address), args);44 const events = await submitTransactionAsync(alice, createMultipleItems);45 const msg = JSON.stringify(uniqueEventMessage(events));46 expect(msg).to.be.contain(checkSection);47 expect(msg).to.be.contain(checkTreasury);48 expect(msg).to.be.contain(checkSystem);49 });50 });51});