12345import { 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 71 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 89 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 107 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});