git.delta.rocks / unique-network / refs/commits / ed322340add8

difftreelog

Merge pull request #60 from usetech-llc/feature/NFTPAR-241

Greg Zaitsev2021-02-03parents: #3f6d973 #b21f673.patch.diff
in: master
Feature/nftpar 241

4 files changed

modifiedtests/package.jsondiffbeforeafterboth
--- a/tests/package.json
+++ b/tests/package.json
@@ -27,6 +27,7 @@
     "testRemoveCollectionAdmin": "mocha --timeout 9999999 -r ts-node/register ./**/removeCollectionAdmin.test.ts",
     "testConnection": "mocha --timeout 9999999 -r ts-node/register ./**/connection.test.ts",
     "testCollection": "mocha --timeout 9999999 -r ts-node/register ./**/createCollection.test.ts",
+    "testCreateMultipleItems": "mocha --timeout 9999999 -r ts-node/register ./**/createMultipleItems.test.ts",
     "testApprove": "mocha --timeout 9999999 -r ts-node/register ./**/approve.test.ts",
     "testTransferFrom": "mocha --timeout 9999999 -r ts-node/register ./**/transferFrom.test.ts",
     "testCreateCollection": "mocha --timeout 9999999 -r ts-node/register ./**/createCollection.test.ts",
modifiedtests/src/createMultipleItems.test.tsdiffbeforeafterboth
before · tests/src/createMultipleItems.test.ts
1//2// This file is subject to the terms and conditions defined in3// file 'LICENSE', which is part of this source code package.4//56import { assert } from 'chai';7import { alicesPublicKey } from './accounts';8import privateKey from './substrate/privateKey';9import usingApi from './substrate/substrate-api';10import waitNewBlocks from './substrate/wait-new-blocks';1112const idCollection = 12;1314describe.skip('integration test: ext. createMultipleItems():', () => {15  it('Create two NFT tokens in active NFT collection', async () => {16    await usingApi(async (api) => {17      const AitemListIndex = await api.query.nft.itemListIndex(idCollection);18      console.log(`itemListIndex count (before): ${AitemListIndex}`);19      const args = ['NFT', 'NFT'];20      const alicePrivateKey = privateKey('//Alice');21      const createMultipleItems = await api.tx.nft22      .createMultipleItems(idCollection, alicesPublicKey, args)23      .signAndSend(alicePrivateKey);24      // tslint:disable-next-line: no-unused-expression25      assert.exists(createMultipleItems, 'createMultipleItems is neither `null` or `undefined`');26      console.log(`Ext. createMultipleItems submitted with hash: ${createMultipleItems}`);27      await waitNewBlocks(api);28      const BitemListIndex = await api.query.nft.itemListIndex(idCollection);29      console.log(`itemListIndex count (after): ${BitemListIndex}`);30      if (BitemListIndex === AitemListIndex) { assert.fail('Corret token not added in collection!'); }31    });32  });33  it('(!negative test!) Create two Fungible tokens in active NFT collection', async () => {34    await usingApi(async (api) => {35      const AitemListIndex = await api.query.nft.itemListIndex(idCollection);36      console.log(`itemListIndex count (before): ${AitemListIndex}`);37      const args = ['Fungible', 'Fungible'];38      const alicePrivateKey = privateKey('//Alice');39      const createMultipleItems = await api.tx.nft40      .createMultipleItems(idCollection, alicesPublicKey, args)41      .signAndSend(alicePrivateKey);42      // tslint:disable-next-line: no-unused-expression43      assert.exists(createMultipleItems, 'createMultipleItems is neither `null` or `undefined`');44      console.log(`Ext. createMultipleItems submitted with hash: ${createMultipleItems}`);45      await waitNewBlocks(api);46      const BitemListIndex = await api.query.nft.itemListIndex(idCollection);47      console.log(`itemListIndex count (after): ${BitemListIndex}`);48      if (BitemListIndex > AitemListIndex) { assert.fail('Incorrect token added in collection!'); }49    });50  });51  it('(!negative test!) Create two ReFungible tokens in active NFT collection', async () => {52    await usingApi(async (api) => {53      const AitemListIndex = await api.query.nft.itemListIndex(idCollection);54      console.log(`itemListIndex count (before): ${AitemListIndex}`);55      const args = ['ReFungible', 'ReFungible'];56      const alicePrivateKey = privateKey('//Alice');57      const createMultipleItems = await api.tx.nft58      .createMultipleItems(idCollection, alicesPublicKey, args)59      .signAndSend(alicePrivateKey);60      // tslint:disable-next-line: no-unused-expression61      assert.exists(createMultipleItems, 'createMultipleItems is neither `null` or `undefined`');62      console.log(`Ext. createMultipleItems submitted with hash: ${createMultipleItems}`);63      await waitNewBlocks(api);64      const BitemListIndex = await api.query.nft.itemListIndex(idCollection);65      console.log(`itemListIndex count (after): ${BitemListIndex}`);66      if (BitemListIndex > AitemListIndex) { assert.fail('Incorrect token added in collection!'); }67    });68  });69});
modifiedtests/src/substrate/substrate-api.tsdiffbeforeafterboth
--- a/tests/src/substrate/substrate-api.ts
+++ b/tests/src/substrate/substrate-api.ts
@@ -123,9 +123,9 @@
 
         // console.log('transactionStatus', transactionStatus, 'events', events);
 
-        if (transactionStatus == TransactionStatus.Success) {
+        if (transactionStatus === TransactionStatus.Success) {
           resolve(events);
-        } else if (transactionStatus == TransactionStatus.Fail) {
+        } else if (transactionStatus === TransactionStatus.Fail) {
           reject(events);
         }
       });
modifiedtests/src/util/helpers.tsdiffbeforeafterboth
--- a/tests/src/util/helpers.ts
+++ b/tests/src/util/helpers.ts
@@ -51,7 +51,7 @@
   Value: BN;
 }
 
-interface IReFungibleTokenDataType {
+export interface IReFungibleTokenDataType {
   Owner: IReFungibleOwner[];
   ConstData: number[];
   VariableData: number[];