git.delta.rocks / unique-network / refs/commits / 4e90c111d3d7

difftreelog

source

tests/src/check-event/createMultipleItemsEvent.test.ts1.6 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, nftEventMessage, normalizeAccountId} from '../util/helpers';1415chai.use(chaiAsPromised);16const expect = chai.expect;1718describe('Create Multiple Items Event event ', () => {19  let alice: IKeyringPair;20  const checkSection = 'ItemCreated';21  const checkTreasury = 'Deposit';22  const checkSystem = 'ExtrinsicSuccess';23  before(async () => {24    await usingApi(async () => {25      alice = privateKey('//Alice');26    });27  });28  it('Check event from createMultipleItems(): ', async () => {29    await usingApi(async (api: ApiPromise) => {30      const collectionID = await createCollectionExpectSuccess();31      const args = [{NFT: ['0x31', '0x31']}, {NFT: ['0x32', '0x32']}, {NFT: ['0x33', '0x33']}];32      const createMultipleItems = api.tx.nft.createMultipleItems(collectionID, normalizeAccountId(alice.address), args);33      const events = await submitTransactionAsync(alice, createMultipleItems);34      const msg = JSON.stringify(nftEventMessage(events));35      expect(msg).to.be.contain(checkSection);36      expect(msg).to.be.contain(checkTreasury);37      expect(msg).to.be.contain(checkSystem);38    });39  });40});