git.delta.rocks / unique-network / refs/commits / 07a6969a6bf5

difftreelog

test(common-migration) polkadot-launch signalling

Fahrrader2022-04-15parent: #5e6da29.patch.diff
in: master

3 files changed

modifiedtests/package.jsondiffbeforeafterboth
--- a/tests/package.json
+++ b/tests/package.json
@@ -84,6 +84,7 @@
     "@polkadot/util-crypto": "^9.1.1",
     "bignumber.js": "^9.0.2",
     "chai-as-promised": "^7.1.1",
+    "find-process": "^1.4.7",
     "solc": "^0.8.13",
     "web3": "^1.7.3"
   },
modifiedtests/src/nesting/migration-check.test.tsdiffbeforeafterboth
before · tests/src/nesting/migration-check.test.ts
1import {expect} from 'chai';2import privateKey from '../substrate/privateKey';3import usingApi, {submitTransactionAsync} from '../substrate/substrate-api';4import {getCreateCollectionResult} from '../util/helpers';5import {IKeyringPair} from '@polkadot/types/types';6import {strToUTF16} from '../util/util';7import waitNewBlocks from '../substrate/wait-new-blocks';89// todo skip10describe.skip('Migration testing for pallet-common', () => {11  let alice: IKeyringPair;12  13  before(async() => {14    await usingApi(async api => {15      alice = privateKey('//Alice');16    });17  });1819  it('Preserves collection settings', async () => {20    let old_version: number;21    let collection_id: number;22    let collection_old: any;2324    await usingApi(async api => {25      // Create a collection for comparison before and after the upgrade26      const tx = api.tx.unique.createCollectionEx({27        mode: 'NFT',28        access: 'AllowList',29        name: strToUTF16("Mojave Pictures"),30        description: strToUTF16("$2.2 billion power plant!"),31        tokenPrefix: '0x0002030',32        offchainSchema: '0x111111',33        schemaVersion: 'Unique',34        limits: {35          accountTokenOwnershipLimit: 3,36        },37        variableOnChainSchema: '0x222222',38        constOnChainSchema: '0x333333',39        metaUpdatePermission: 'Admin',40      });41      const events = await submitTransactionAsync(alice, tx);42      const result = getCreateCollectionResult(events);43      collection_id = result.collectionId;4445      // Get the pre-upgrade collection info46      collection_old = (await api.query.common.collectionById(collection_id)).toJSON();4748      // Get the pre-upgrade spec version49      old_version = (api.consts.system.version.toJSON() as any).specVersion;50    });5152    console.log(`Now waiting for the parachain upgrade from ${old_version!}...`);5354    let new_version = old_version!;55    let connection_fail_counter = 0;5657    // And wait for the parachain upgrade58    while (new_version == old_version! && connection_fail_counter < 2) {59      try {60        await usingApi(async api => {61          await waitNewBlocks(api);62          new_version = (api.consts.system.version.toJSON() as any).specVersion;63        });64      } catch (_) {65        connection_fail_counter++;66        await new Promise( resolve => setTimeout(resolve, 12000) );67      }68    }6970    await usingApi(async api => {71      const collection_new = (await api.query.common.collectionById(collection_id)).toJSON() as any;72      73      // Make sure the extra fields are what they should be74      const variable_on_chain_schema = await api.query.common.collectionData(collection_id, "VariableOnChainSchema");75      const const_on_chain_schema = await api.query.common.collectionData(collection_id, "ConstOnChainSchema");76      const offchain_schema = await api.query.common.collectionData(collection_id, "OffchainSchema");7778      expect(variable_on_chain_schema.toHex()).to.be.deep.equal((collection_old.variableOnChainSchema));79      expect(const_on_chain_schema.toHex()).to.be.deep.equal(collection_old.constOnChainSchema);80      expect(offchain_schema.toHex()).to.be.deep.equal(collection_old.offchainSchema);81      expect(collection_new).to.have.nested.property('limits.nestingRule');8283      // Get rid of extra fields to perform comparison on the rest of the collection84      delete collection_new.limits.nestingRule;85      delete collection_old.constOnChainSchema;86      delete collection_old.offchainSchema;87      delete collection_old.variableOnChainSchema;8889      expect(collection_new).to.be.deep.equal(collection_old);90    });91  });92});93  
modifiedtests/yarn.lockdiffbeforeafterboth
--- a/tests/yarn.lock
+++ b/tests/yarn.lock
@@ -3698,6 +3698,11 @@
   resolved "https://registry.yarnpkg.com/commander/-/commander-4.1.1.tgz#9fd602bd936294e9e9ef46a3f4d6964044b18068"
   integrity sha512-NOKm8xhkzAjzFx8B2v5OAHT+u5pRQc2UCa2Vq9jYL/31o2wi9mxBA7LIFs3sV5VSC49z6pEhfbMULvShKj26WA==
 
+commander@^5.1.0:
+  version "5.1.0"
+  resolved "https://registry.yarnpkg.com/commander/-/commander-5.1.0.tgz#46abbd1652f8e059bddaef99bbdcb2ad9cf179ae"
+  integrity sha512-P0CysNDQ7rtVw4QIQtm+MRxV66vKFSvlsQvGYXZWR3qFU0jlMKHZZZgw8e+8DSah4UDKMqnknRDQz+xuQXQ/Zg==
+
 commander@^7.2.0:
   version "7.2.0"
   resolved "https://registry.yarnpkg.com/commander/-/commander-7.2.0.tgz#a36cb57d0b501ce108e4d20559a150a391d97ab7"
@@ -5054,6 +5059,15 @@
   resolved "https://registry.yarnpkg.com/find-index/-/find-index-0.1.1.tgz#675d358b2ca3892d795a1ab47232f8b6e2e0dde4"
   integrity sha1-Z101iyyjiS15Whq0cjL4tuLg3eQ=
 
+find-process@^1.4.7:
+  version "1.4.7"
+  resolved "https://registry.yarnpkg.com/find-process/-/find-process-1.4.7.tgz#8c76962259216c381ef1099371465b5b439ea121"
+  integrity sha512-/U4CYp1214Xrp3u3Fqr9yNynUrr5Le4y0SsJh2lMDDSbpwYSz3M2SMWQC+wqcx79cN8PQtHQIL8KnuY9M66fdg==
+  dependencies:
+    chalk "^4.0.0"
+    commander "^5.1.0"
+    debug "^4.1.1"
+
 find-up@5.0.0:
   version "5.0.0"
   resolved "https://registry.yarnpkg.com/find-up/-/find-up-5.0.0.tgz#4c92819ecb7083561e4f4a240a86be5198f536fc"