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 Item 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 createItem(): ', async () => {40 await usingApi(async (api: ApiPromise) => {41 const collectionID = await createCollectionExpectSuccess();42 const createItem = api.tx.unique.createItem(collectionID, normalizeAccountId(alice.address), 'NFT');43 const events = await submitTransactionAsync(alice, createItem);44 const msg = JSON.stringify(uniqueEventMessage(events));45 expect(msg).to.be.contain(checkSection);46 expect(msg).to.be.contain(checkTreasury);47 expect(msg).to.be.contain(checkSystem);48 });49 });50});