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.tsdiffbeforeafterboth1import {expect} from 'chai';2import {getApiConnection} from '../substrate/substrate-api';3import {createBase, addTheme} from './util/tx';4import {expectTxFailure, requirePallets, Pallets} from './util/helpers';5import {getThemeNames} from './util/fetch';67describe('integration test: add Theme to Base', () => {8 let api: any;9 before(async function() {10 api = await getApiConnection();11 await requirePallets(this, [Pallets.RmrkEquip]);12 });1314 const alice = '//Alice';15 const bob = '//Bob';1617 it('add default theme', async () => {18 const baseId = await createBase(api, alice, 'default-themed-base', 'DTBase', []);19 await addTheme(api, alice, baseId, {20 name: 'default',21 properties: [22 {23 key: 'some-key',24 value: 'some-key-value',25 },26 {27 key: 'another-key',28 value: 'another-key-value',29 },30 ],31 });32 });3334 it('add default theme and a custom one', async () => {35 const baseId = await createBase(api, alice, '2-themed-base', '2TBase', []);36 await addTheme(api, alice, baseId, {37 name: 'default',38 properties: [39 {40 key: 'default-key',41 value: 'default-key-value',42 },43 ],44 });45 await addTheme(api, alice, baseId, {46 name: 'custom-theme',47 properties: [48 {49 key: 'custom-key-0',50 value: 'custom-key-value-0',51 },52 {53 key: 'custom-key-1',54 value: 'custom-key-value-1',55 },56 ],57 });58 });5960 it('fetch filtered theme keys', async () => {61 const baseId = await createBase(api, alice, '2-themed-base', '2TBase', []);62 await addTheme(api, alice, baseId, {63 name: 'default',64 properties: [65 {66 key: 'first-key',67 value: 'first-key-value',68 },69 {70 key: 'second-key',71 value: 'second-key-value',72 },73 ],74 }, ['second-key']);75 });7677 it('fetch theme names', async() => {78 const baseId = await createBase(api, alice, '3-themed-base', '3TBase', []);79 const names = [80 'default',81 'first-theme',82 'second-theme',83 ];8485 for (let i = 0; i < names.length; i++) {86 await addTheme(api, alice, baseId, {name: names[i], properties: [{key: 'dummy', value: 'dummy'}]});87 }8889 const fetchedNames = await getThemeNames(api, baseId);9091 for (let i = 0; i < names.length; i++) {92 const isFound = fetchedNames.find((name) => name === names[i]) !== undefined;9394 expect(isFound, 'Error: invalid theme names').to.be.true;95 }96 });9798 it('[negative] unable to add theme to non-existing base', async () => {99 const maxBaseId = 0xFFFFFFFF;100 const tx = addTheme(api, alice, maxBaseId, {101 name: 'default',102 properties: [],103 });104105 await expectTxFailure(/rmrkEquip\.BaseDoesntExist/, tx);106 });107108 it('[negative] unable to add custom theme if no default theme', async () => {109 const baseId = await createBase(api, alice, 'no-default-themed-base', 'NDTBase', []);110 const tx = addTheme(api, alice, baseId, {111 name: 'custom-theme',112 properties: [],113 });114115 await expectTxFailure(/rmrkEquip\.NeedsDefaultThemeFirst/, tx);116 });117118 it('[negative] unable to add theme by a not-an-owner', async () => {119 const baseId = await createBase(api, alice, 'no-default-themed-base', 'NDTBase', []);120 const tx = addTheme(api, bob, baseId, {121 name: 'default',122 properties: [],123 });124125 await expectTxFailure(/rmrkEquip\.PermissionError/, tx);126 });127128 after(() => { api.disconnect(); });129});1import {expect} from 'chai';2import {getApiConnection} from '../substrate/substrate-api';3import {createBase, addTheme} from './util/tx';4import {expectTxFailure, requirePallets, Pallets} from './util/helpers';5import {getThemeNames} from './util/fetch';67describe('integration test: add Theme to Base', () => {8 let api: any;9 before(async function() {10 api = await getApiConnection();11 await requirePallets(this, [Pallets.RmrkEquip]);12 });1314 const alice = '//Alice';15 const bob = '//Bob';1617 it('add default theme', async () => {18 const baseId = await createBase(api, alice, 'default-themed-base', 'DTBase', []);19 await addTheme(api, alice, baseId, {20 name: 'default',21 properties: [22 {23 key: 'some-key',24 value: 'some-key-value',25 },26 {27 key: 'another-key',28 value: 'another-key-value',29 },30 ],31 });32 });3334 it('add default theme and a custom one', async () => {35 const baseId = await createBase(api, alice, '2-themed-base', '2TBase', []);36 await addTheme(api, alice, baseId, {37 name: 'default',38 properties: [39 {40 key: 'default-key',41 value: 'default-key-value',42 },43 ],44 });45 await addTheme(api, alice, baseId, {46 name: 'custom-theme',47 properties: [48 {49 key: 'custom-key-0',50 value: 'custom-key-value-0',51 },52 {53 key: 'custom-key-1',54 value: 'custom-key-value-1',55 },56 ],57 });58 });5960 it('fetch filtered theme keys', async () => {61 const baseId = await createBase(api, alice, '2-themed-base', '2TBase', []);62 await addTheme(api, alice, baseId, {63 name: 'default',64 properties: [65 {66 key: 'first-key',67 value: 'first-key-value',68 },69 {70 key: 'second-key',71 value: 'second-key-value',72 },73 ],74 }, ['second-key']);75 });7677 it('fetch theme names', async() => {78 const baseId = await createBase(api, alice, '3-themed-base', '3TBase', []);79 const names = [80 'default',81 'first-theme',82 'second-theme',83 ];8485 for (let i = 0; i < names.length; i++) {86 await addTheme(api, alice, baseId, {name: names[i], properties: [{key: 'dummy', value: 'dummy'}]});87 }8889 const fetchedNames = await getThemeNames(api, baseId);9091 for (let i = 0; i < names.length; i++) {92 const isFound = fetchedNames.find((name) => name === names[i]) !== undefined;9394 expect(isFound, 'Error: invalid theme names').to.be.true;95 }96 });9798 it('[negative] unable to add theme to non-existing base', async () => {99 const maxBaseId = 0xFFFFFFFF;100 const tx = addTheme(api, alice, maxBaseId, {101 name: 'default',102 properties: [],103 });104105 await expectTxFailure(/rmrkEquip\.BaseDoesntExist/, tx);106 });107108 it('[negative] unable to add custom theme if no default theme', async () => {109 const baseId = await createBase(api, alice, 'no-default-themed-base', 'NDTBase', []);110 const tx = addTheme(api, alice, baseId, {111 name: 'custom-theme',112 properties: [],113 });114115 await expectTxFailure(/rmrkEquip\.NeedsDefaultThemeFirst/, tx);116 });117118 it('[negative] unable to add theme by a not-an-owner', async () => {119 const baseId = await createBase(api, alice, 'no-default-themed-base', 'NDTBase', []);120 const tx = addTheme(api, bob, baseId, {121 name: 'default',122 properties: [],123 });124125 await expectTxFailure(/rmrkEquip\.PermissionError/, tx);126 });127128 after(async() => { await api.disconnect(); });129});tests/src/rmrk/burnNft.test.tsdiffbeforeafterboth--- a/tests/src/rmrk/burnNft.test.ts
+++ b/tests/src/rmrk/burnNft.test.ts
@@ -166,7 +166,5 @@
});
});
- after(() => {
- api.disconnect();
- });
+ after(async() => { await api.disconnect(); });
});
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(); });
});