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
--- 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(); });
 });
modifiedtests/src/rmrk/setNftProperty.test.tsdiffbeforeafterboth
before · tests/src/rmrk/setNftProperty.test.ts
1import {getApiConnection} from '../substrate/substrate-api';2import {NftIdTuple} from './util/fetch';3import {expectTxFailure, requirePallets, Pallets} from './util/helpers';4import {createCollection, mintNft, sendNft, setNftProperty} from './util/tx';56describe('integration test: set NFT property', () => {7  let api: any;8  before(async function () {9    api = await getApiConnection();10    await requirePallets(this, [Pallets.RmrkCore]);11  });1213  const alice = '//Alice';14  const bob = '//Bob';1516  const createTestCollection = async (issuerUri: string) => {17    return await createCollection(18      api,19      issuerUri,20      'setprop-nft-collection-metadata',21      null,22      'setprop',23    );24  };2526  it('set NFT property', async () => {27    const ownerAlice = alice;2829    const collectionId = await createTestCollection(alice);30    const nftId = await mintNft(api, alice, ownerAlice, collectionId, 'prop-nft');3132    await setNftProperty(api, alice, collectionId, nftId, 'test-key', 'test-key-value');33    await setNftProperty(api, alice, collectionId, nftId, 'test-key', 'updated-key-value');34    await setNftProperty(api, alice, collectionId, nftId, 'second-test-key', 'second-test-key-value');35  });3637  it('[negative] unable to set a property of non-existing NFT', async () => {38    const collectionId = 0;39    const maxNftId = 0xFFFFFFFF;4041    const tx = setNftProperty(api, alice, collectionId, maxNftId, 'test-key', 'test-value');4243    await expectTxFailure(/rmrkCore\.NoAvailableNftId/, tx);44  });4546  it('[negative] unable to set a property by not-an-owner', async () => {47    const ownerAlice = alice;4849    const collectionId = await createTestCollection(alice);50    const nftId = await mintNft(api, alice, ownerAlice, collectionId, 'prop-nft');5152    const tx = setNftProperty(api, bob, collectionId, nftId, 'test-key', 'test-key-value');5354    await expectTxFailure(/rmrkCore\.NoPermission/, tx);55  });5657  it('set a property to nested NFT', async () => {58    const ownerAlice = alice;5960    const collectionId = await createTestCollection(alice);61    const parentNftId = await mintNft(api, alice, ownerAlice, collectionId, 'prop-parent-nft');62    const childNftId = await mintNft(api, alice, ownerAlice, collectionId, 'prop-child-nft');6364    const ownerNft: NftIdTuple = [collectionId, parentNftId];6566    await sendNft(api, 'sent', ownerAlice, collectionId, childNftId, ownerNft);6768    await setNftProperty(api, alice, collectionId, childNftId, 'test-key', 'test-key-value');69  });7071  it('[negative] set a property to nested NFT (by not-root-owner)', async () => {72    const ownerAlice = alice;7374    const collectionId = await createTestCollection(alice);75    const parentNftId = await mintNft(api, alice, ownerAlice, collectionId, 'prop-parent-nft');76    const childNftId = await mintNft(api, alice, ownerAlice, collectionId, 'prop-child-nft');7778    const ownerNft: NftIdTuple = [collectionId, parentNftId];7980    await sendNft(api, 'sent', ownerAlice, collectionId, childNftId, ownerNft);8182    const tx = setNftProperty(api, bob, collectionId, childNftId, 'test-key', 'test-key-value');8384    await expectTxFailure(/rmrkCore\.NoPermission/, tx);85  });8687  after(() => { api.disconnect(); });88});
after · tests/src/rmrk/setNftProperty.test.ts
1import {getApiConnection} from '../substrate/substrate-api';2import {NftIdTuple} from './util/fetch';3import {expectTxFailure, requirePallets, Pallets} from './util/helpers';4import {createCollection, mintNft, sendNft, setNftProperty} from './util/tx';56describe('integration test: set NFT property', () => {7  let api: any;8  before(async function () {9    api = await getApiConnection();10    await requirePallets(this, [Pallets.RmrkCore]);11  });1213  const alice = '//Alice';14  const bob = '//Bob';1516  const createTestCollection = async (issuerUri: string) => {17    return await createCollection(18      api,19      issuerUri,20      'setprop-nft-collection-metadata',21      null,22      'setprop',23    );24  };2526  it('set NFT property', async () => {27    const ownerAlice = alice;2829    const collectionId = await createTestCollection(alice);30    const nftId = await mintNft(api, alice, ownerAlice, collectionId, 'prop-nft');3132    await setNftProperty(api, alice, collectionId, nftId, 'test-key', 'test-key-value');33    await setNftProperty(api, alice, collectionId, nftId, 'test-key', 'updated-key-value');34    await setNftProperty(api, alice, collectionId, nftId, 'second-test-key', 'second-test-key-value');35  });3637  it('[negative] unable to set a property of non-existing NFT', async () => {38    const collectionId = 0;39    const maxNftId = 0xFFFFFFFF;4041    const tx = setNftProperty(api, alice, collectionId, maxNftId, 'test-key', 'test-value');4243    await expectTxFailure(/rmrkCore\.NoAvailableNftId/, tx);44  });4546  it('[negative] unable to set a property by not-an-owner', async () => {47    const ownerAlice = alice;4849    const collectionId = await createTestCollection(alice);50    const nftId = await mintNft(api, alice, ownerAlice, collectionId, 'prop-nft');5152    const tx = setNftProperty(api, bob, collectionId, nftId, 'test-key', 'test-key-value');5354    await expectTxFailure(/rmrkCore\.NoPermission/, tx);55  });5657  it('set a property to nested NFT', async () => {58    const ownerAlice = alice;5960    const collectionId = await createTestCollection(alice);61    const parentNftId = await mintNft(api, alice, ownerAlice, collectionId, 'prop-parent-nft');62    const childNftId = await mintNft(api, alice, ownerAlice, collectionId, 'prop-child-nft');6364    const ownerNft: NftIdTuple = [collectionId, parentNftId];6566    await sendNft(api, 'sent', ownerAlice, collectionId, childNftId, ownerNft);6768    await setNftProperty(api, alice, collectionId, childNftId, 'test-key', 'test-key-value');69  });7071  it('[negative] set a property to nested NFT (by not-root-owner)', async () => {72    const ownerAlice = alice;7374    const collectionId = await createTestCollection(alice);75    const parentNftId = await mintNft(api, alice, ownerAlice, collectionId, 'prop-parent-nft');76    const childNftId = await mintNft(api, alice, ownerAlice, collectionId, 'prop-child-nft');7778    const ownerNft: NftIdTuple = [collectionId, parentNftId];7980    await sendNft(api, 'sent', ownerAlice, collectionId, childNftId, ownerNft);8182    const tx = setNftProperty(api, bob, collectionId, childNftId, 'test-key', 'test-key-value');8384    await expectTxFailure(/rmrkCore\.NoPermission/, tx);85  });8687  after(async() => { await api.disconnect(); });88});
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(); });
 });