git.delta.rocks / unique-network / refs/commits / 99f3d75dc724

difftreelog

burnItemEvent migrated

rkv2022-09-26parent: #9e6bd66.patch.diff
in: master

1 file changed

modifiedtests/src/check-event/burnItemEvent.test.tsdiffbeforeafterboth
15// along with Unique Network. If not, see <http://www.gnu.org/licenses/>.15// along with Unique Network. If not, see <http://www.gnu.org/licenses/>.
1616
17// https://unique-network.readthedocs.io/en/latest/jsapi.html#setchainlimits17// https://unique-network.readthedocs.io/en/latest/jsapi.html#setchainlimits
18import {ApiPromise} from '@polkadot/api';
19import {IKeyringPair} from '@polkadot/types/types';18import {IKeyringPair} from '@polkadot/types/types';
20import chai from 'chai';
21import chaiAsPromised from 'chai-as-promised';
22import usingApi, {submitTransactionAsync} from '../substrate/substrate-api';19import {executeTransaction} from '../substrate/substrate-api';
23import {createCollectionExpectSuccess, createItemExpectSuccess, uniqueEventMessage} from '../util/helpers';20import {uniqueEventMessage} from '../util/helpers';
24
25chai.use(chaiAsPromised);
26const expect = chai.expect;21import {usingPlaygrounds, expect, itSub} from '../util/playgrounds';
22
2723
28describe('Burn Item event ', () => {24describe('Burn Item event ', () => {
29 let alice: IKeyringPair;25 let alice: IKeyringPair;
30 const checkSection = 'ItemDestroyed';26 const checkSection = 'ItemDestroyed';
31 const checkTreasury = 'Deposit';27 const checkTreasury = 'Deposit';
32 const checkSystem = 'ExtrinsicSuccess';28 const checkSystem = 'ExtrinsicSuccess';
33 before(async () => {29 before(async () => {
34 await usingApi(async (api, privateKeyWrapper) => {30 await usingPlaygrounds(async (helper, privateKey) => {
35 alice = privateKeyWrapper('//Alice');31 const donor = privateKey('//Alice');
32 [alice] = await helper.arrange.createAccounts([10n], donor);
36 });33 });
37 });34 });
38 it('Check event from burnItem(): ', async () => {35 itSub('Check event from burnItem(): ', async ({helper}) => {
39 await usingApi(async (api: ApiPromise) => {36 const collection = await helper.nft.mintCollection(alice, {name: 'test', description: 'test', tokenPrefix: 'test'});
40 const collectionID = await createCollectionExpectSuccess();37 const token = await collection.mintToken(alice, {Substrate: alice.address});
41 const itemID = await createItemExpectSuccess(alice, collectionID, 'NFT');38
42 const burnItem = api.tx.unique.burnItem(collectionID, itemID, 1);39 const tx = helper.api!.tx.unique.burnItem(collection.collectionId, token.tokenId, 1);
43 const events = await submitTransactionAsync(alice, burnItem);40 const events = await executeTransaction(helper.api!, alice, tx);
44 const msg = JSON.stringify(uniqueEventMessage(events));41 const msg = JSON.stringify(uniqueEventMessage(events));
45 expect(msg).to.be.contain(checkSection);42 expect(msg).to.be.contain(checkSection);
46 expect(msg).to.be.contain(checkTreasury);43 expect(msg).to.be.contain(checkTreasury);
47 expect(msg).to.be.contain(checkSystem);44 expect(msg).to.be.contain(checkSystem);
48 });
49 });45 });
50});46});
5147