difftreelog
fix RMRK disconnect
in: master
20 files changed
tests/src/rmrk/acceptNft.test.tsdiffbeforeafterboth--- a/tests/src/rmrk/acceptNft.test.ts
+++ b/tests/src/rmrk/acceptNft.test.ts
@@ -103,5 +103,5 @@
expect(isChild).to.be.false;
});
- after(() => { api.disconnect(); });
+ after(async() => { await api.disconnect(); });
});
tests/src/rmrk/addResource.test.tsdiffbeforeafterboth--- a/tests/src/rmrk/addResource.test.ts
+++ b/tests/src/rmrk/addResource.test.ts
@@ -432,6 +432,6 @@
after(() => {
- api.disconnect();
+ after(async() => { await api.disconnect(); });
});
});
tests/src/rmrk/addTheme.test.tsdiffbeforeafterboth--- a/tests/src/rmrk/addTheme.test.ts
+++ b/tests/src/rmrk/addTheme.test.ts
@@ -125,5 +125,5 @@
await expectTxFailure(/rmrkEquip\.PermissionError/, tx);
});
- after(() => { api.disconnect(); });
+ after(async() => { await api.disconnect(); });
});
tests/src/rmrk/burnNft.test.tsdiffbeforeafterboth1import {getApiConnection} from '../substrate/substrate-api';2import {expectTxFailure, requirePallets, Pallets} from './util/helpers';3import {NftIdTuple, getChildren} from './util/fetch';4import {burnNft, createCollection, sendNft, mintNft} from './util/tx';56import chai from 'chai';7import chaiAsPromised from 'chai-as-promised';89chai.use(chaiAsPromised);10const expect = chai.expect;1112describe('integration test: burn nft', () => {13 const Alice = '//Alice';14 const Bob = '//Bob';1516 let api: any;17 before(async function() {18 api = await getApiConnection();19 await requirePallets(this, [Pallets.RmrkCore]);20 });212223 it('burn nft', async () => {24 await createCollection(25 api,26 Alice,27 'test-metadata',28 null,29 'test-symbol',30 ).then(async (collectionId) => {31 const nftId = await mintNft(32 api,33 Alice,34 Alice,35 collectionId,36 'nft-metadata',37 );38 await burnNft(api, Alice, collectionId, nftId);39 });40 });4142 it('burn nft with children', async () => {43 const collectionId = await createCollection(44 api,45 Alice,46 'test-metadata',47 null,48 'test-symbol',49 );5051 const parentNftId = await mintNft(52 api,53 Alice,54 Alice,55 collectionId,56 'nft-metadata',57 );5859 const childNftId = await mintNft(60 api,61 Alice,62 Alice,63 collectionId,64 'nft-metadata',65 );6667 const newOwnerNFT: NftIdTuple = [collectionId, parentNftId];6869 await sendNft(api, 'sent', Alice, collectionId, childNftId, newOwnerNFT);7071 const childrenBefore = await getChildren(api, collectionId, parentNftId);72 expect(childrenBefore.length === 1, 'Error: parent NFT should have children')73 .to.be.true;7475 const child = childrenBefore[0];76 expect(child.collectionId.eq(collectionId), 'Error: invalid child collection Id')77 .to.be.true;7879 expect(child.nftId.eq(childNftId), 'Error: invalid child NFT Id')80 .to.be.true;8182 await burnNft(api, Alice, collectionId, parentNftId);8384 const childrenAfter = await getChildren(api, collectionId, parentNftId);8586 expect(childrenAfter.length === 0, 'Error: children should be burned').to.be.true;87 });8889 it('burn child nft', async () => {90 const collectionId = await createCollection(91 api,92 Alice,93 'test-metadata',94 null,95 'test-symbol',96 );9798 const parentNftId = await mintNft(99 api,100 Alice,101 Alice,102 collectionId,103 'nft-metadata',104 );105106 const childNftId = await mintNft(107 api,108 Alice,109 Alice,110 collectionId,111 'nft-metadata',112 );113114 const newOwnerNFT: NftIdTuple = [collectionId, parentNftId];115116 await sendNft(api, 'sent', Alice, collectionId, childNftId, newOwnerNFT);117118 const childrenBefore = await getChildren(api, collectionId, parentNftId);119 expect(childrenBefore.length === 1, 'Error: parent NFT should have children')120 .to.be.true;121122 const child = childrenBefore[0];123 expect(child.collectionId.eq(collectionId), 'Error: invalid child collection Id')124 .to.be.true;125126 expect(child.nftId.eq(childNftId), 'Error: invalid child NFT Id')127 .to.be.true;128129 await burnNft(api, Alice, collectionId, childNftId);130131 const childrenAfter = await getChildren(api, collectionId, parentNftId);132133 expect(childrenAfter.length === 0, 'Error: children should be burned').to.be.true;134 });135136 it('[negative] burn non-existing NFT', async () => {137 await createCollection(138 api,139 Alice,140 'test-metadata',141 null,142 'test-symbol',143 ).then(async (collectionId) => {144 const tx = burnNft(api, Alice, collectionId, 99999);145 await expectTxFailure(/rmrkCore\.NoAvailableNftId/, tx);146 });147 });148149 it('[negative] burn not an owner NFT user', async () => {150 await createCollection(151 api,152 Alice,153 'test-metadata',154 null,155 'test-symbol',156 ).then(async (collectionId) => {157 const nftId = await mintNft(158 api,159 Alice,160 Alice,161 collectionId,162 'nft-metadata',163 );164 const tx = burnNft(api, Bob, collectionId, nftId);165 await expectTxFailure(/rmrkCore\.NoPermission/, tx);166 });167 });168169 after(() => {170 api.disconnect();171 });172});tests/src/rmrk/changeCollectionIssuer.test.tsdiffbeforeafterboth--- a/tests/src/rmrk/changeCollectionIssuer.test.ts
+++ b/tests/src/rmrk/changeCollectionIssuer.test.ts
@@ -49,7 +49,5 @@
});
});
- after(() => {
- api.disconnect();
- });
+ after(async() => { await api.disconnect(); });
});
tests/src/rmrk/createBase.test.tsdiffbeforeafterboth--- a/tests/src/rmrk/createBase.test.ts
+++ b/tests/src/rmrk/createBase.test.ts
@@ -84,5 +84,5 @@
]);
});
- after(() => { api.disconnect(); });
+ after(async() => { await api.disconnect(); });
});
tests/src/rmrk/createCollection.test.tsdiffbeforeafterboth--- a/tests/src/rmrk/createCollection.test.ts
+++ b/tests/src/rmrk/createCollection.test.ts
@@ -21,5 +21,5 @@
await createCollection(api, alice, 'no-limit-metadata', null, 'no-limit-symbol');
});
- after(() => { api.disconnect(); });
+ after(async() => { await api.disconnect(); });
});
tests/src/rmrk/deleteCollection.test.tsdiffbeforeafterboth--- a/tests/src/rmrk/deleteCollection.test.ts
+++ b/tests/src/rmrk/deleteCollection.test.ts
@@ -42,7 +42,5 @@
});
});
- after(() => {
- api.disconnect();
- });
+ after(async() => { await api.disconnect(); });
});
tests/src/rmrk/equipNft.test.tsdiffbeforeafterboth--- a/tests/src/rmrk/equipNft.test.ts
+++ b/tests/src/rmrk/equipNft.test.ts
@@ -336,7 +336,5 @@
await expectTxFailure(/rmrkEquip\.CollectionNotEquippable/, tx);
});
- after(() => {
- api.disconnect();
- });
+ after(async() => { await api.disconnect(); });
});
tests/src/rmrk/getOwnedNfts.test.tsdiffbeforeafterboth--- a/tests/src/rmrk/getOwnedNfts.test.ts
+++ b/tests/src/rmrk/getOwnedNfts.test.ts
@@ -76,5 +76,5 @@
});
});
- after(() => { api.disconnect(); });
+ after(async() => { await api.disconnect(); });
});
tests/src/rmrk/lockCollection.test.tsdiffbeforeafterboth--- a/tests/src/rmrk/lockCollection.test.ts
+++ b/tests/src/rmrk/lockCollection.test.ts
@@ -112,7 +112,5 @@
});
});
- after(() => {
- api.disconnect();
- });
+ after(async() => { await api.disconnect(); });
});
tests/src/rmrk/mintNft.test.tsdiffbeforeafterboth--- a/tests/src/rmrk/mintNft.test.ts
+++ b/tests/src/rmrk/mintNft.test.ts
@@ -207,5 +207,5 @@
expect(nft.isSome).to.be.false;
});
- after(() => { api.disconnect(); });
+ after(async() => { await api.disconnect(); });
});
tests/src/rmrk/rejectNft.test.tsdiffbeforeafterboth--- a/tests/src/rmrk/rejectNft.test.ts
+++ b/tests/src/rmrk/rejectNft.test.ts
@@ -90,5 +90,5 @@
await expectTxFailure(/rmrkCore\.CannotRejectNonPendingNft/, tx);
});
- after(() => { api.disconnect(); });
+ after(async() => { await api.disconnect(); });
});
tests/src/rmrk/removeResource.test.tsdiffbeforeafterboth--- a/tests/src/rmrk/removeResource.test.ts
+++ b/tests/src/rmrk/removeResource.test.ts
@@ -343,7 +343,5 @@
await expectTxFailure(/rmrkCore\.NoPermission/, tx);
});
- after(() => {
- api.disconnect();
- });
+ after(async() => { await api.disconnect(); });
});
tests/src/rmrk/rmrkIsolation.test.tsdiffbeforeafterboth--- a/tests/src/rmrk/rmrkIsolation.test.ts
+++ b/tests/src/rmrk/rmrkIsolation.test.ts
@@ -90,7 +90,7 @@
bob = privateKey('//Bob');
normalizedAlice = {Substrate: helper.address.normalizeSubstrateToChainFormat(alice.address)};
- requirePalletsOrSkip(this, helper, [Pallets.RmrkCore]);
+ await requirePalletsOrSkip(this, helper, [Pallets.RmrkCore]);
const collectionIds = await createRmrkCollection(helper, alice);
uniqueCollectionId = collectionIds.uniqueId;
tests/src/rmrk/sendNft.test.tsdiffbeforeafterboth--- a/tests/src/rmrk/sendNft.test.ts
+++ b/tests/src/rmrk/sendNft.test.ts
@@ -251,5 +251,5 @@
await expectTxFailure(/rmrkCore\.NoPermission/, tx);
});
- after(() => { api.disconnect(); });
+ after(async() => { await api.disconnect(); });
});
tests/src/rmrk/setCollectionProperty.test.tsdiffbeforeafterboth--- a/tests/src/rmrk/setCollectionProperty.test.ts
+++ b/tests/src/rmrk/setCollectionProperty.test.ts
@@ -62,7 +62,5 @@
});
});
- after(() => {
- api.disconnect();
- });
+ after(async() => { await api.disconnect(); });
});
tests/src/rmrk/setEquippableList.test.tsdiffbeforeafterboth--- a/tests/src/rmrk/setEquippableList.test.ts
+++ b/tests/src/rmrk/setEquippableList.test.ts
@@ -110,5 +110,5 @@
await expectTxFailure(/rmrkEquip\.PartDoesntExist/, tx);
});
- after(() => { api.disconnect(); });
+ after(async() => { await api.disconnect(); });
});
tests/src/rmrk/setNftProperty.test.tsdiffbeforeafterboth--- a/tests/src/rmrk/setNftProperty.test.ts
+++ b/tests/src/rmrk/setNftProperty.test.ts
@@ -84,5 +84,5 @@
await expectTxFailure(/rmrkCore\.NoPermission/, tx);
});
- after(() => { api.disconnect(); });
+ after(async() => { await api.disconnect(); });
});
tests/src/rmrk/setResourcePriorities.test.tsdiffbeforeafterboth--- a/tests/src/rmrk/setResourcePriorities.test.ts
+++ b/tests/src/rmrk/setResourcePriorities.test.ts
@@ -54,5 +54,5 @@
await expectTxFailure(/rmrkCore\.NoAvailableNftId/, tx);
});
- after(() => { api.disconnect(); });
+ after(async() => { await api.disconnect(); });
});