git.delta.rocks / unique-network / refs/commits / b056347d6cb1

difftreelog

source

tests/src/check-event/transferFromEvent.test.ts1.5 KiBsourcehistory
1//2// This file is subject to the terms and conditions defined in3// file 'LICENSE', which is part of this source code package.4//56// https://unique-network.readthedocs.io/en/latest/jsapi.html#setchainlimits7import { ApiPromise } from '@polkadot/api';8import { IKeyringPair } from '@polkadot/types/types';9import chai from 'chai';10import chaiAsPromised from 'chai-as-promised';11import privateKey from '../substrate/privateKey';12import usingApi, {submitTransactionAsync} from '../substrate/substrate-api';13import { createCollectionExpectSuccess, createItemExpectSuccess, nftEventMessage } from '../util/helpers';1415chai.use(chaiAsPromised);16const expect = chai.expect;1718describe('Transfer from event ', () => {19  let Alice: IKeyringPair;20  let Bob: IKeyringPair;21  const checkTreasury = 'Deposit';22  const checkSystem = 'ExtrinsicSuccess';23  before(async () => {24    await usingApi(async () => {25      Alice = privateKey('//Alice');26      Bob = privateKey('//Bob');27    });28  });29  it('Check event from transferFrom(): ', async () => {30    await usingApi(async (api: ApiPromise) => {31      const collectionID = await createCollectionExpectSuccess();32      const itemID = await createItemExpectSuccess(Alice, collectionID, 'NFT');33      const transferFrom = api.tx.nft.transferFrom(Alice.address, Bob.address, collectionID, itemID, 1);34      const events = await submitTransactionAsync(Alice, transferFrom);35      const msg = JSON.stringify(nftEventMessage(events));36      expect(msg).to.be.contain(checkTreasury);37      expect(msg).to.be.contain(checkSystem);38    });39  });40});41