git.delta.rocks / unique-network / refs/commits / 104c91ace9f1

difftreelog

fix remove aux func getMessage

rkv2022-10-04parent: #da2d600.patch.diff
in: master

7 files changed

modifiedtests/src/check-event/burnItemEvent.test.tsdiffbeforeafterboth
1616
17// https://unique-network.readthedocs.io/en/latest/jsapi.html#setchainlimits17// https://unique-network.readthedocs.io/en/latest/jsapi.html#setchainlimits
18import {IKeyringPair} from '@polkadot/types/types';18import {IKeyringPair} from '@polkadot/types/types';
19import {getEventMessage} from '../util/helpers';
20import {usingPlaygrounds, expect, itSub} from '../util/playgrounds';19import {usingPlaygrounds, expect, itSub} from '../util/playgrounds';
20import {IEvent} from '../util/playgrounds/types';
2121
2222
23describe('Burn Item event ', () => {23describe('Burn Item event ', () => {
24 let alice: IKeyringPair;24 let alice: IKeyringPair;
25 const checkSection = 'ItemDestroyed';
26 const checkTreasury = 'Deposit';
27 const checkSystem = 'ExtrinsicSuccess';
28 before(async () => {25 before(async () => {
29 await usingPlaygrounds(async (helper, privateKey) => {26 await usingPlaygrounds(async (helper, privateKey) => {
30 const donor = privateKey('//Alice');27 const donor = privateKey('//Alice');
36 const token = await collection.mintToken(alice, {Substrate: alice.address});33 const token = await collection.mintToken(alice, {Substrate: alice.address});
37 await token.burn(alice);34 await token.burn(alice);
3835
39 const msg = JSON.stringify(getEventMessage(helper.chainLog[helper.chainLog.length - 1].events));36 const event = helper.chainLog[helper.chainLog.length - 1].events as IEvent[];
37 const eventStrings = event.map(e => `${e.section}.${e.method}`);
38
40 expect(msg).to.be.contain(checkSection);39 expect(eventStrings).to.contains('common.ItemDestroyed');
41 expect(msg).to.be.contain(checkTreasury);40 expect(eventStrings).to.contains('treasury.Deposit');
42 expect(msg).to.be.contain(checkSystem);41 expect(eventStrings).to.contains('system.ExtrinsicSuccess');
43 });42 });
44});43});
4544
modifiedtests/src/check-event/createCollectionEvent.test.tsdiffbeforeafterboth
1616
17// https://unique-network.readthedocs.io/en/latest/jsapi.html#setchainlimits17// https://unique-network.readthedocs.io/en/latest/jsapi.html#setchainlimits
18import {IKeyringPair} from '@polkadot/types/types';18import {IKeyringPair} from '@polkadot/types/types';
19import {getEventMessage} from '../util/helpers';
20import {usingPlaygrounds, itSub, expect} from '../util/playgrounds';19import {usingPlaygrounds, itSub, expect} from '../util/playgrounds';
20import {IEvent} from '../util/playgrounds/types';
2121
22describe('Create collection event ', () => {22describe('Create collection event ', () => {
23 let alice: IKeyringPair;23 let alice: IKeyringPair;
24 const checkSection = 'CollectionCreated';
25 const checkTreasury = 'Deposit';
26 const checkSystem = 'ExtrinsicSuccess';
27 before(async () => {24 before(async () => {
28 await usingPlaygrounds(async (helper, privateKey) => {25 await usingPlaygrounds(async (helper, privateKey) => {
29 const donor = privateKey('//Alice');26 const donor = privateKey('//Alice');
32 });29 });
33 itSub('Check event from createCollection(): ', async ({helper}) => {30 itSub('Check event from createCollection(): ', async ({helper}) => {
34 await helper.nft.mintCollection(alice, {name: 'test', description: 'test', tokenPrefix: 'test'});31 await helper.nft.mintCollection(alice, {name: 'test', description: 'test', tokenPrefix: 'test'});
35 const msg = JSON.stringify(getEventMessage(helper.chainLog[helper.chainLog.length - 1].events));32 const event = helper.chainLog[helper.chainLog.length - 1].events as IEvent[];
33 const eventStrings = event.map(e => `${e.section}.${e.method}`);
34
36 expect(msg).to.be.contain(checkSection);35 expect(eventStrings).to.contains('common.CollectionCreated');
37 expect(msg).to.be.contain(checkTreasury);36 expect(eventStrings).to.contains('treasury.Deposit');
38 expect(msg).to.be.contain(checkSystem);37 expect(eventStrings).to.contains('system.ExtrinsicSuccess');
39 });38 });
40});39});
4140
modifiedtests/src/check-event/createItemEvent.test.tsdiffbeforeafterboth
1616
17// https://unique-network.readthedocs.io/en/latest/jsapi.html#setchainlimits17// https://unique-network.readthedocs.io/en/latest/jsapi.html#setchainlimits
18import {IKeyringPair} from '@polkadot/types/types';18import {IKeyringPair} from '@polkadot/types/types';
19import {getEventMessage} from '../util/helpers';
20import {itSub, usingPlaygrounds, expect} from '../util/playgrounds';19import {itSub, usingPlaygrounds, expect} from '../util/playgrounds';
20import {IEvent} from '../util/playgrounds/types';
2121
22describe('Create Item event ', () => {22describe('Create Item event ', () => {
23 let alice: IKeyringPair;23 let alice: IKeyringPair;
24 const checkSection = 'ItemCreated';
25 const checkTreasury = 'Deposit';
26 const checkSystem = 'ExtrinsicSuccess';
27 before(async () => {24 before(async () => {
28 await usingPlaygrounds(async (helper, privateKey) => {25 await usingPlaygrounds(async (helper, privateKey) => {
29 const donor = privateKey('//Alice');26 const donor = privateKey('//Alice');
33 itSub('Check event from createItem(): ', async ({helper}) => {30 itSub('Check event from createItem(): ', async ({helper}) => {
34 const collection = await helper.nft.mintCollection(alice, {name: 'test', description: 'test', tokenPrefix: 'test'});31 const collection = await helper.nft.mintCollection(alice, {name: 'test', description: 'test', tokenPrefix: 'test'});
35 await collection.mintToken(alice, {Substrate: alice.address});32 await collection.mintToken(alice, {Substrate: alice.address});
36 const msg = JSON.stringify(getEventMessage(helper.chainLog[helper.chainLog.length - 1].events));33 const event = helper.chainLog[helper.chainLog.length - 1].events as IEvent[];
34 const eventStrings = event.map(e => `${e.section}.${e.method}`);
35
37 expect(msg).to.be.contain(checkSection);36 expect(eventStrings).to.contains('common.ItemCreated');
38 expect(msg).to.be.contain(checkTreasury);37 expect(eventStrings).to.contains('treasury.Deposit');
39 expect(msg).to.be.contain(checkSystem);38 expect(eventStrings).to.contains('system.ExtrinsicSuccess');
40 });39 });
41});40});
4241
modifiedtests/src/check-event/createMultipleItemsEvent.test.tsdiffbeforeafterboth
1616
17// https://unique-network.readthedocs.io/en/latest/jsapi.html#setchainlimits17// https://unique-network.readthedocs.io/en/latest/jsapi.html#setchainlimits
18import {IKeyringPair} from '@polkadot/types/types';18import {IKeyringPair} from '@polkadot/types/types';
19import {getEventMessage} from '../util/helpers';
20import {usingPlaygrounds, itSub, expect} from '../util/playgrounds';19import {usingPlaygrounds, itSub, expect} from '../util/playgrounds';
20import {IEvent} from '../util/playgrounds/types';
2121
22describe('Create Multiple Items Event event ', () => {22describe('Create Multiple Items Event event ', () => {
23 let alice: IKeyringPair;23 let alice: IKeyringPair;
24 const checkSection = 'ItemCreated';
25 const checkTreasury = 'Deposit';
26 const checkSystem = 'ExtrinsicSuccess';
27 before(async () => {24 before(async () => {
28 await usingPlaygrounds(async (helper, privateKey) => {25 await usingPlaygrounds(async (helper, privateKey) => {
29 const donor = privateKey('//Alice');26 const donor = privateKey('//Alice');
38 {owner: {Substrate: alice.address}},35 {owner: {Substrate: alice.address}},
39 ]);36 ]);
4037
41 const msg = JSON.stringify(getEventMessage(helper.chainLog[helper.chainLog.length - 1].events));38 const event = helper.chainLog[helper.chainLog.length - 1].events as IEvent[];
39 const eventStrings = event.map(e => `${e.section}.${e.method}`);
40
42 expect(msg).to.be.contain(checkSection);41 expect(eventStrings).to.contains('common.ItemCreated');
43 expect(msg).to.be.contain(checkTreasury);42 expect(eventStrings).to.contains('treasury.Deposit');
44 expect(msg).to.be.contain(checkSystem);43 expect(eventStrings).to.contains('system.ExtrinsicSuccess');
45 });44 });
46});45});
4746
modifiedtests/src/check-event/destroyCollectionEvent.test.tsdiffbeforeafterboth
1616
17// https://unique-network.readthedocs.io/en/latest/jsapi.html#setchainlimits17// https://unique-network.readthedocs.io/en/latest/jsapi.html#setchainlimits
18import {IKeyringPair} from '@polkadot/types/types';18import {IKeyringPair} from '@polkadot/types/types';
19import {getEventMessage} from '../util/helpers';
20import {itSub, usingPlaygrounds, expect} from '../util/playgrounds';19import {itSub, usingPlaygrounds, expect} from '../util/playgrounds';
20import {IEvent} from '../util/playgrounds/types';
2121
22describe('Destroy collection event ', () => {22describe('Destroy collection event ', () => {
23 let alice: IKeyringPair;23 let alice: IKeyringPair;
24 const checkTreasury = 'Deposit';
25 const checkSystem = 'ExtrinsicSuccess';
26 before(async () => {24 before(async () => {
27 await usingPlaygrounds(async (helper, privateKey) => {25 await usingPlaygrounds(async (helper, privateKey) => {
28 const donor = privateKey('//Alice');26 const donor = privateKey('//Alice');
33 itSub('Check event from destroyCollection(): ', async ({helper}) => {31 itSub('Check event from destroyCollection(): ', async ({helper}) => {
34 const collection = await helper.nft.mintCollection(alice, {name: 'test', description: 'test', tokenPrefix: 'test'});32 const collection = await helper.nft.mintCollection(alice, {name: 'test', description: 'test', tokenPrefix: 'test'});
35 await collection.burn(alice);33 await collection.burn(alice);
36 const msg = JSON.stringify(getEventMessage(helper.chainLog[helper.chainLog.length - 1].events));34 const event = helper.chainLog[helper.chainLog.length - 1].events as IEvent[];
35 const eventStrings = event.map(e => `${e.section}.${e.method}`);
36
37 expect(msg).to.be.contain(checkTreasury);37 expect(eventStrings).to.contains('common.CollectionDestroyed');
38 expect(msg).to.be.contain(checkSystem);38 expect(eventStrings).to.contains('treasury.Deposit');
39 expect(eventStrings).to.contains('system.ExtrinsicSuccess');
39 });40 });
40});41});
4142
modifiedtests/src/check-event/transferEvent.test.tsdiffbeforeafterboth
1616
17// https://unique-network.readthedocs.io/en/latest/jsapi.html#setchainlimits17// https://unique-network.readthedocs.io/en/latest/jsapi.html#setchainlimits
18import {IKeyringPair} from '@polkadot/types/types';18import {IKeyringPair} from '@polkadot/types/types';
19import {getEventMessage} from '../util/helpers';
20import {usingPlaygrounds, expect, itSub} from '../util/playgrounds';19import {usingPlaygrounds, expect, itSub} from '../util/playgrounds';
20import {IEvent} from '../util/playgrounds/types';
2121
22describe('Transfer event ', () => {22describe('Transfer event ', () => {
23 let alice: IKeyringPair;23 let alice: IKeyringPair;
24 let bob: IKeyringPair;24 let bob: IKeyringPair;
25 const checkSection = 'Transfer';
26 const checkTreasury = 'Deposit';
27 const checkSystem = 'ExtrinsicSuccess';
2825
29 before(async () => {26 before(async () => {
30 await usingPlaygrounds(async (helper, privateKey) => {27 await usingPlaygrounds(async (helper, privateKey) => {
37 const collection = await helper.nft.mintCollection(alice, {name: 'test', description: 'test', tokenPrefix: 'test'});34 const collection = await helper.nft.mintCollection(alice, {name: 'test', description: 'test', tokenPrefix: 'test'});
38 const token = await collection.mintToken(alice, {Substrate: alice.address});35 const token = await collection.mintToken(alice, {Substrate: alice.address});
39 await token.transfer(alice, {Substrate: bob.address});36 await token.transfer(alice, {Substrate: bob.address});
40 const msg = JSON.stringify(getEventMessage(helper.chainLog[helper.chainLog.length - 1].events));37 const event = helper.chainLog[helper.chainLog.length - 1].events as IEvent[];
38 const eventStrings = event.map(e => `${e.section}.${e.method}`);
39
41 expect(msg).to.be.contain(checkSection);40 expect(eventStrings).to.contains('common.Transfer');
42 expect(msg).to.be.contain(checkTreasury);41 expect(eventStrings).to.contains('treasury.Deposit');
43 expect(msg).to.be.contain(checkSystem);42 expect(eventStrings).to.contains('system.ExtrinsicSuccess');
44 });43 });
45});44});
4645
modifiedtests/src/check-event/transferFromEvent.test.tsdiffbeforeafterboth
1616
17// https://unique-network.readthedocs.io/en/latest/jsapi.html#setchainlimits17// https://unique-network.readthedocs.io/en/latest/jsapi.html#setchainlimits
18import {IKeyringPair} from '@polkadot/types/types';18import {IKeyringPair} from '@polkadot/types/types';
19import {getEventMessage} from '../util/helpers';
20import {usingPlaygrounds, expect, itSub} from '../util/playgrounds';19import {usingPlaygrounds, expect, itSub} from '../util/playgrounds';
20import {IEvent} from '../util/playgrounds/types';
2121
22describe('Transfer event ', () => {22describe('Transfer event ', () => {
23 let alice: IKeyringPair;23 let alice: IKeyringPair;
24 let bob: IKeyringPair;24 let bob: IKeyringPair;
25 const checkSection = 'Transfer';
26 const checkTreasury = 'Deposit';
27 const checkSystem = 'ExtrinsicSuccess';
28
29 before(async () => {25 before(async () => {
30 await usingPlaygrounds(async (helper, privateKey) => {26 await usingPlaygrounds(async (helper, privateKey) => {
37 const collection = await helper.nft.mintCollection(alice, {name: 'test', description: 'test', tokenPrefix: 'test'});33 const collection = await helper.nft.mintCollection(alice, {name: 'test', description: 'test', tokenPrefix: 'test'});
38 const token = await collection.mintToken(alice, {Substrate: alice.address});34 const token = await collection.mintToken(alice, {Substrate: alice.address});
39 await token.transferFrom(alice, {Substrate: alice.address}, {Substrate: bob.address});35 await token.transferFrom(alice, {Substrate: alice.address}, {Substrate: bob.address});
40 const msg = JSON.stringify(getEventMessage(helper.chainLog[helper.chainLog.length - 1].events));36 const event = helper.chainLog[helper.chainLog.length - 1].events as IEvent[];
37 const eventStrings = event.map(e => `${e.section}.${e.method}`);
38
41 expect(msg).to.be.contain(checkSection);39 expect(eventStrings).to.contains('common.Transfer');
42 expect(msg).to.be.contain(checkTreasury);40 expect(eventStrings).to.contains('treasury.Deposit');
43 expect(msg).to.be.contain(checkSystem);41 expect(eventStrings).to.contains('system.ExtrinsicSuccess');
44 });42 });
45});43});
4644