--- a/tests/src/check-event/createMultipleItemsEvent.test.ts +++ b/tests/src/check-event/createMultipleItemsEvent.test.ts @@ -15,15 +15,10 @@ // along with Unique Network. If not, see . // https://unique-network.readthedocs.io/en/latest/jsapi.html#setchainlimits -import {ApiPromise} from '@polkadot/api'; import {IKeyringPair} from '@polkadot/types/types'; -import chai from 'chai'; -import chaiAsPromised from 'chai-as-promised'; -import usingApi, {submitTransactionAsync} from '../substrate/substrate-api'; -import {createCollectionExpectSuccess, uniqueEventMessage, normalizeAccountId} from '../util/helpers'; - -chai.use(chaiAsPromised); -const expect = chai.expect; +import {executeTransaction} from '../substrate/substrate-api'; +import {uniqueEventMessage, normalizeAccountId} from '../util/helpers'; +import {usingPlaygrounds, itSub, expect} from '../util/playgrounds'; describe('Create Multiple Items Event event ', () => { let alice: IKeyringPair; @@ -31,20 +26,19 @@ const checkTreasury = 'Deposit'; const checkSystem = 'ExtrinsicSuccess'; before(async () => { - await usingApi(async (api, privateKeyWrapper) => { - alice = privateKeyWrapper('//Alice'); + await usingPlaygrounds(async (helper, privateKey) => { + const donor = privateKey('//Alice'); + [alice] = await helper.arrange.createAccounts([10n], donor); }); }); - it('Check event from createMultipleItems(): ', async () => { - await usingApi(async (api: ApiPromise) => { - const collectionID = await createCollectionExpectSuccess(); - const args = [{NFT: {}}, {NFT: {}}, {NFT: {}}]; - const createMultipleItems = api.tx.unique.createMultipleItems(collectionID, normalizeAccountId(alice.address), args); - const events = await submitTransactionAsync(alice, createMultipleItems); - const msg = JSON.stringify(uniqueEventMessage(events)); - expect(msg).to.be.contain(checkSection); - expect(msg).to.be.contain(checkTreasury); - expect(msg).to.be.contain(checkSystem); - }); + itSub('Check event from createMultipleItems(): ', async ({helper}) => { + const {collectionId} = await helper.nft.mintCollection(alice, {name: 'test', description: 'test', tokenPrefix: 'test'}); + const args = [{NFT: {}}, {NFT: {}}, {NFT: {}}]; + const createMultipleItemsTx = helper.api!.tx.unique.createMultipleItems(collectionId, normalizeAccountId(alice.address), args); + const events = await executeTransaction(helper.api!, alice, createMultipleItemsTx); + const msg = JSON.stringify(uniqueEventMessage(events)); + expect(msg).to.be.contain(checkSection); + expect(msg).to.be.contain(checkTreasury); + expect(msg).to.be.contain(checkSystem); }); });