git.delta.rocks / unique-network / refs/commits / 50109b665ea6

difftreelog

fix RMRK disconnect

Daniel Shiposha2022-10-14parent: #2c2096c.patch.diff
in: master

20 files changed

modifiedtests/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(); });
 });
modifiedtests/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(); });
   });
 });
modifiedtests/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(); });
 });
modifiedtests/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(); });
 });
modifiedtests/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(); });
 });
modifiedtests/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(); });
 });
modifiedtests/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(); });
 });
modifiedtests/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(); });
 });
modifiedtests/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(); });
 });
modifiedtests/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(); });
 });
modifiedtests/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(); });
 });
modifiedtests/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(); });
 });
modifiedtests/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(); });
 });
modifiedtests/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(); });
 });
modifiedtests/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;
modifiedtests/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(); });
 });
modifiedtests/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(); });
 });
modifiedtests/src/rmrk/setEquippableList.test.tsdiffbeforeafterboth
before · tests/src/rmrk/setEquippableList.test.ts
1import {getApiConnection} from '../substrate/substrate-api';2import {expectTxFailure, requirePallets, Pallets} from './util/helpers';3import {createCollection, createBase, setEquippableList} from './util/tx';45describe("integration test: set slot's Equippable List", () => {6  let api: any;7  before(async function () {8    api = await getApiConnection();9    await requirePallets(this, [Pallets.RmrkCore]);10  });1112  const alice = '//Alice';13  const bob = '//Bob';1415  it("set Base's slot Equippable List", async () => {16    const collectionIds = [17      await createCollection(18        api,19        alice,20        'equiplist-collection-metadata',21        null,22        'equiplist-0',23      ),24      await createCollection(25        api,26        alice,27        'equiplist-collection-metadata',28        null,29        'equiplist-1',30      ),31    ];3233    const slotId = 202;3435    const baseId = await createBase(api, alice, 'slotpartany-base-type', 'slotpartany', [36      {37        'SlotPart': {38          id: slotId,39          equippable: 'All',40          z: 1,41          src: 'some-fallback-slot-url',42        },43      },44    ]);4546    await setEquippableList(api, alice, baseId, slotId, 'All');47    await setEquippableList(api, alice, baseId, slotId, 'Empty');48    await setEquippableList(api, alice, baseId, slotId, {'Custom': collectionIds});49  });5051  it('[negative] unable to set equippable list of a slot of non-existing base', async () => {52    const maxBaseId = 0xFFFFFFFF;53    const slotId = 0;5455    const tx = setEquippableList(api, alice, maxBaseId, slotId, 'All');56    await expectTxFailure(/rmrkEquip\.BaseDoesntExist/, tx);57  });5859  it('[negative] unable to set equippable list by a not-an-owner', async () => {60    const slotId = 42;6162    const baseId = await createBase(api, alice, 'slotpartany-base-type', 'slotpartany', [63      {64        'SlotPart': {65          id: slotId,66          equippable: 'All',67          z: 1,68          src: 'some-fallback-slot-url',69        },70      },71    ]);7273    const tx = setEquippableList(api, bob, baseId, slotId, 'All');74    await expectTxFailure(/rmrkEquip\.PermissionError/, tx);75  });7677  it('[negative] unable to set equippable list to a fixed part', async () => {78    const fixedPartId = 42;7980    const baseId = await createBase(api, alice, 'fixedpart-base-type', 'fixedpart', [81      {82        'FixedPart': {83          id: fixedPartId,84          z: 0,85          src: 'fixed-part-url',86        },87      },88    ]);8990    const tx = setEquippableList(api, alice, baseId, fixedPartId, 'All');91    await expectTxFailure(/rmrkEquip\.NoEquippableOnFixedPart/, tx);92  });9394  it('[negative] unable to set equippable list to non-existing slot', async () => {95    const slotId = 777;96    const maxSlotId = 0xFFFFFFFF;9798    const baseId = await createBase(api, alice, 'slotpartany-base-type', 'slotpartany', [99      {100        'SlotPart': {101          id: slotId,102          equippable: 'All',103          z: 1,104          src: 'some-fallback-slot-url',105        },106      },107    ]);108109    const tx = setEquippableList(api, alice, baseId, maxSlotId, 'All');110    await expectTxFailure(/rmrkEquip\.PartDoesntExist/, tx);111  });112113  after(() => { api.disconnect(); });114});
after · tests/src/rmrk/setEquippableList.test.ts
1import {getApiConnection} from '../substrate/substrate-api';2import {expectTxFailure, requirePallets, Pallets} from './util/helpers';3import {createCollection, createBase, setEquippableList} from './util/tx';45describe("integration test: set slot's Equippable List", () => {6  let api: any;7  before(async function () {8    api = await getApiConnection();9    await requirePallets(this, [Pallets.RmrkCore]);10  });1112  const alice = '//Alice';13  const bob = '//Bob';1415  it("set Base's slot Equippable List", async () => {16    const collectionIds = [17      await createCollection(18        api,19        alice,20        'equiplist-collection-metadata',21        null,22        'equiplist-0',23      ),24      await createCollection(25        api,26        alice,27        'equiplist-collection-metadata',28        null,29        'equiplist-1',30      ),31    ];3233    const slotId = 202;3435    const baseId = await createBase(api, alice, 'slotpartany-base-type', 'slotpartany', [36      {37        'SlotPart': {38          id: slotId,39          equippable: 'All',40          z: 1,41          src: 'some-fallback-slot-url',42        },43      },44    ]);4546    await setEquippableList(api, alice, baseId, slotId, 'All');47    await setEquippableList(api, alice, baseId, slotId, 'Empty');48    await setEquippableList(api, alice, baseId, slotId, {'Custom': collectionIds});49  });5051  it('[negative] unable to set equippable list of a slot of non-existing base', async () => {52    const maxBaseId = 0xFFFFFFFF;53    const slotId = 0;5455    const tx = setEquippableList(api, alice, maxBaseId, slotId, 'All');56    await expectTxFailure(/rmrkEquip\.BaseDoesntExist/, tx);57  });5859  it('[negative] unable to set equippable list by a not-an-owner', async () => {60    const slotId = 42;6162    const baseId = await createBase(api, alice, 'slotpartany-base-type', 'slotpartany', [63      {64        'SlotPart': {65          id: slotId,66          equippable: 'All',67          z: 1,68          src: 'some-fallback-slot-url',69        },70      },71    ]);7273    const tx = setEquippableList(api, bob, baseId, slotId, 'All');74    await expectTxFailure(/rmrkEquip\.PermissionError/, tx);75  });7677  it('[negative] unable to set equippable list to a fixed part', async () => {78    const fixedPartId = 42;7980    const baseId = await createBase(api, alice, 'fixedpart-base-type', 'fixedpart', [81      {82        'FixedPart': {83          id: fixedPartId,84          z: 0,85          src: 'fixed-part-url',86        },87      },88    ]);8990    const tx = setEquippableList(api, alice, baseId, fixedPartId, 'All');91    await expectTxFailure(/rmrkEquip\.NoEquippableOnFixedPart/, tx);92  });9394  it('[negative] unable to set equippable list to non-existing slot', async () => {95    const slotId = 777;96    const maxSlotId = 0xFFFFFFFF;9798    const baseId = await createBase(api, alice, 'slotpartany-base-type', 'slotpartany', [99      {100        'SlotPart': {101          id: slotId,102          equippable: 'All',103          z: 1,104          src: 'some-fallback-slot-url',105        },106      },107    ]);108109    const tx = setEquippableList(api, alice, baseId, maxSlotId, 'All');110    await expectTxFailure(/rmrkEquip\.PartDoesntExist/, tx);111  });112113  after(async() => { await api.disconnect(); });114});
modifiedtests/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(); });
 });
modifiedtests/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(); });
 });