difftreelog
createMultipleItems test
in: master
3 files changed
tests/package-lock.jsondiffbeforeafterboth--- a/tests/package-lock.json
+++ b/tests/package-lock.json
@@ -4824,6 +4824,11 @@
"integrity": "sha512-1HcDas8SEj4z1Wc696tH56G8OlRaH/sqZOynNNB+HF0WOeXPaxTtbYzJY2oEfiUxjSKjhCKr+MvR7dCHcEelug==",
"dev": true
},
+ "@types/sprintf-js": {
+ "version": "1.1.2",
+ "resolved": "https://registry.npmjs.org/@types/sprintf-js/-/sprintf-js-1.1.2.tgz",
+ "integrity": "sha512-hkgzYF+qnIl8uTO8rmUSVSfQ8BIfMXC4yJAF4n8BE758YsKBZvFC4NumnAegj7KmylP0liEZNpb9RRGFMbFejA=="
+ },
"@types/stack-utils": {
"version": "1.0.1",
"resolved": "https://registry.npmjs.org/@types/stack-utils/-/stack-utils-1.0.1.tgz",
@@ -5867,6 +5872,14 @@
"dev": true,
"requires": {
"sprintf-js": "~1.0.2"
+ },
+ "dependencies": {
+ "sprintf-js": {
+ "version": "1.0.3",
+ "resolved": "https://registry.npmjs.org/sprintf-js/-/sprintf-js-1.0.3.tgz",
+ "integrity": "sha1-BOaSb2YolTVPPdAVIDYzuFcpfiw=",
+ "dev": true
+ }
}
},
"arr-diff": {
@@ -20684,10 +20697,9 @@
}
},
"sprintf-js": {
- "version": "1.0.3",
- "resolved": "https://registry.npmjs.org/sprintf-js/-/sprintf-js-1.0.3.tgz",
- "integrity": "sha1-BOaSb2YolTVPPdAVIDYzuFcpfiw=",
- "dev": true
+ "version": "1.1.2",
+ "resolved": "https://registry.npmjs.org/sprintf-js/-/sprintf-js-1.1.2.tgz",
+ "integrity": "sha512-VE0SOVEHCk7Qc8ulkWw3ntAzXuqf7S2lvwQaDLRnUeIEaKNQJzV6BwmLKhOqT61aGhfUMrXeaBk+oDGCzvhcug=="
},
"sshpk": {
"version": "1.16.1",
tests/package.jsondiffbeforeafterboth--- a/tests/package.json
+++ b/tests/package.json
@@ -21,7 +21,8 @@
"testSetSchemaVersion": "mocha --timeout 9999999 -r ts-node/register ./**/setSchemaVersion.test.ts",
"testSetCollectionLimits": "mocha --timeout 9999999 -r ts-node/register ./**/setCollectionLimits.test.ts",
"testConnection": "mocha --timeout 9999999 -r ts-node/register ./**/connection.test.ts",
- "testCollection": "mocha --timeout 9999999 -r ts-node/register ./**/createCollection.test.ts"
+ "testCollection": "mocha --timeout 9999999 -r ts-node/register ./**/createCollection.test.ts",
+ "testCreateMultipleItems": "mocha --timeout 9999999 -r ts-node/register ./**/createMultipleItems.test.ts"
},
"author": "",
"license": "Apache 2.0",
tests/src/createMultipleItems.test.tsdiffbeforeafterboth1//2// This file is subject to the terms and conditions defined in3// file 'LICENSE', which is part of this source code package.4//5import { ApiPromise } from '@polkadot/api';6import { 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('Integration Test createMultipleItems(collection_id, owner, items_data):', () => {15 it('Create 0x31, 0x32, 0x33 items in active NFT collection and verify tokens data in chain', async () => {16 await usingApi(async (api: ApiPromise) => {1718 });19 });20});2122describe('Negative Integration Test createMultipleItems(collection_id, owner, items_data):', () => {23 it('Create token with not existing type', async () => {24 await usingApi(async (api: ApiPromise) => {2526 });27 });2829 it('Create token in not existing collection', async () => {30 await usingApi(async (api: ApiPromise) => {3132 });33 });3435 it('Create token that has reached the maximum data limit', async () => {36 await usingApi(async (api: ApiPromise) => {3738 });39 });4041 it('Create tokens with different types', async () => {42 await usingApi(async (api: ApiPromise) => {4344 });45 });4647 it('Create tokens in not existing collection', async () => {48 await usingApi(async (api: ApiPromise) => {4950 });51 });5253 it('Create tokens with different data limits <> maximum data limit', async () => {54 await usingApi(async (api: ApiPromise) => {5556 });57 });58});5960describe.skip('integration test: ext. createMultipleItems():', () => {61 it('Create two NFT tokens in active NFT collection', async () => {62 await usingApi(async (api) => {63 const AitemListIndex = await api.query.nft.itemListIndex(idCollection);64 console.log(`itemListIndex count (before): ${AitemListIndex}`);65 const args = ['NFT', 'NFT'];66 const alicePrivateKey = privateKey('//Alice');67 const createMultipleItems = await api.tx.nft68 .createMultipleItems(idCollection, alicesPublicKey, args)69 .signAndSend(alicePrivateKey);70 // tslint:disable-next-line: no-unused-expression71 assert.exists(createMultipleItems, 'createMultipleItems is neither `null` or `undefined`');72 console.log(`Ext. createMultipleItems submitted with hash: ${createMultipleItems}`);73 await waitNewBlocks(api);74 const BitemListIndex = await api.query.nft.itemListIndex(idCollection);75 console.log(`itemListIndex count (after): ${BitemListIndex}`);76 if (BitemListIndex === AitemListIndex) { assert.fail('Corret token not added in collection!'); }77 });78 });79 it('(!negative test!) Create two Fungible tokens in active NFT collection', async () => {80 await usingApi(async (api) => {81 const AitemListIndex = await api.query.nft.itemListIndex(idCollection);82 console.log(`itemListIndex count (before): ${AitemListIndex}`);83 const args = ['Fungible', 'Fungible'];84 const alicePrivateKey = privateKey('//Alice');85 const createMultipleItems = await api.tx.nft86 .createMultipleItems(idCollection, alicesPublicKey, args)87 .signAndSend(alicePrivateKey);88 // tslint:disable-next-line: no-unused-expression89 assert.exists(createMultipleItems, 'createMultipleItems is neither `null` or `undefined`');90 console.log(`Ext. createMultipleItems submitted with hash: ${createMultipleItems}`);91 await waitNewBlocks(api);92 const BitemListIndex = await api.query.nft.itemListIndex(idCollection);93 console.log(`itemListIndex count (after): ${BitemListIndex}`);94 if (BitemListIndex > AitemListIndex) { assert.fail('Incorrect token added in collection!'); }95 });96 });97 it('(!negative test!) Create two ReFungible tokens in active NFT collection', async () => {98 await usingApi(async (api) => {99 const AitemListIndex = await api.query.nft.itemListIndex(idCollection);100 console.log(`itemListIndex count (before): ${AitemListIndex}`);101 const args = ['ReFungible', 'ReFungible'];102 const alicePrivateKey = privateKey('//Alice');103 const createMultipleItems = await api.tx.nft104 .createMultipleItems(idCollection, alicesPublicKey, args)105 .signAndSend(alicePrivateKey);106 // tslint:disable-next-line: no-unused-expression107 assert.exists(createMultipleItems, 'createMultipleItems is neither `null` or `undefined`');108 console.log(`Ext. createMultipleItems submitted with hash: ${createMultipleItems}`);109 await waitNewBlocks(api);110 const BitemListIndex = await api.query.nft.itemListIndex(idCollection);111 console.log(`itemListIndex count (after): ${BitemListIndex}`);112 if (BitemListIndex > AitemListIndex) { assert.fail('Incorrect token added in collection!'); }113 });114 });115});