difftreelog
createMultipleItems tests
in: master
1 file changed
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//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});1//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});