From 5861102c1fccb2143273ed20f8a6569f1b59c9d5 Mon Sep 17 00:00:00 2001 From: rkv Date: Mon, 26 Sep 2022 12:01:30 +0000 Subject: [PATCH] createItemEvent migrated --- --- a/tests/src/check-event/createItemEvent.test.ts +++ b/tests/src/check-event/createItemEvent.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 {itSub, usingPlaygrounds, expect} from '../util/playgrounds'; describe('Create Item event ', () => { let alice: IKeyringPair; @@ -31,19 +26,18 @@ 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 createItem(): ', async () => { - await usingApi(async (api: ApiPromise) => { - const collectionID = await createCollectionExpectSuccess(); - const createItem = api.tx.unique.createItem(collectionID, normalizeAccountId(alice.address), 'NFT'); - const events = await submitTransactionAsync(alice, createItem); - 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 createItem(): ', async ({helper}) => { + const collection = await helper.nft.mintCollection(alice, {name: 'test', description: 'test', tokenPrefix: 'test'}); + const createItemTx = helper.api!.tx.unique.createItem(collection.collectionId, normalizeAccountId(alice.address), 'NFT'); + const events = await executeTransaction(helper.api!, alice, createItemTx); + const msg = JSON.stringify(uniqueEventMessage(events)); + expect(msg).to.be.contain(checkSection); + expect(msg).to.be.contain(checkTreasury); + expect(msg).to.be.contain(checkSystem); }); }); -- gitstuff