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, createItemExpectSuccess, uniqueEventMessage, normalizeAccountId} from '../util/helpers';2526chai.use(chaiAsPromised);27const expect = chai.expect;2829describe('Transfer from event ', () => {30 let alice: IKeyringPair;31 let bob: IKeyringPair;32 const checkSection = 'Transfer';33 const checkTreasury = 'Deposit';34 const checkSystem = 'ExtrinsicSuccess';35 before(async () => {36 await usingApi(async () => {37 alice = privateKey('//Alice');38 bob = privateKey('//Bob');39 });40 });41 it('Check event from transferFrom(): ', async () => {42 await usingApi(async (api: ApiPromise) => {43 const collectionID = await createCollectionExpectSuccess();44 const itemID = await createItemExpectSuccess(alice, collectionID, 'NFT');45 const transferFrom = api.tx.unique.transferFrom(normalizeAccountId(alice.address), normalizeAccountId(bob.address), collectionID, itemID, 1);46 const events = await submitTransactionAsync(alice, transferFrom);47 const msg = JSON.stringify(uniqueEventMessage(events));48 expect(msg).to.be.contain(checkSection);49 expect(msg).to.be.contain(checkTreasury);50 expect(msg).to.be.contain(checkSystem);51 });52 });53});