difftreelog
test fix eslint warnings
in: master
4 files changed
tests/src/createItem.test.tsdiffbeforeafterboth1// Copyright 2019-2022 Unique Network (Gibraltar) Ltd.2// This file is part of Unique Network.34// Unique Network is free software: you can redistribute it and/or modify5// it under the terms of the GNU General Public License as published by6// the Free Software Foundation, either version 3 of the License, or7// (at your option) any later version.89// Unique Network is distributed in the hope that it will be useful,10// but WITHOUT ANY WARRANTY; without even the implied warranty of11// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the12// GNU General Public License for more details.1314// You should have received a copy of the GNU General Public License15// along with Unique Network. If not, see <http://www.gnu.org/licenses/>.1617import {default as usingApi, executeTransaction} from './substrate/substrate-api';18import chai from 'chai';19import {Keyring} from '@polkadot/api';20import {IKeyringPair} from '@polkadot/types/types';21import {22 createCollectionExpectSuccess,23 createItemExpectSuccess,24 addCollectionAdminExpectSuccess,25 createCollectionWithPropsExpectSuccess,26 createItemWithPropsExpectSuccess,27 createItemWithPropsExpectFailure,28} from './util/helpers';2930const expect = chai.expect;31let alice: IKeyringPair;32let bob: IKeyringPair;3334describe('integration test: ext. ():', () => {35 before(async () => {36 await usingApi(async () => {37 const keyring = new Keyring({type: 'sr25519'});38 alice = keyring.addFromUri('//Alice');39 bob = keyring.addFromUri('//Bob');40 });41 });4243 it('Create new item in NFT collection', async () => {44 const createMode = 'NFT';45 const newCollectionID = await createCollectionExpectSuccess({mode: {type: createMode}});46 await createItemExpectSuccess(alice, newCollectionID, createMode);47 });48 it('Create new item in Fungible collection', async () => {49 const createMode = 'Fungible';50 const newCollectionID = await createCollectionExpectSuccess({mode: {type: createMode, decimalPoints: 0}});51 await createItemExpectSuccess(alice, newCollectionID, createMode);52 });53 it('Create new item in ReFungible collection', async () => {54 const createMode = 'ReFungible';55 const newCollectionID = await createCollectionExpectSuccess({mode: {type: createMode}});56 await createItemExpectSuccess(alice, newCollectionID, createMode);57 });58 it('Create new item in NFT collection with collection admin permissions', async () => {59 const createMode = 'NFT';60 const newCollectionID = await createCollectionExpectSuccess({mode: {type: createMode}});61 await addCollectionAdminExpectSuccess(alice, newCollectionID, bob.address);62 await createItemExpectSuccess(bob, newCollectionID, createMode);63 });64 it('Create new item in Fungible collection with collection admin permissions', async () => {65 const createMode = 'Fungible';66 const newCollectionID = await createCollectionExpectSuccess({mode: {type: createMode, decimalPoints: 0}});67 await addCollectionAdminExpectSuccess(alice, newCollectionID, bob.address);68 await createItemExpectSuccess(bob, newCollectionID, createMode);69 });70 it('Create new item in ReFungible collection with collection admin permissions', async () => {71 const createMode = 'ReFungible';72 const newCollectionID = await createCollectionExpectSuccess({mode: {type: createMode}});73 await addCollectionAdminExpectSuccess(alice, newCollectionID, bob.address);74 await createItemExpectSuccess(bob, newCollectionID, createMode);75 });7677 it('Set property Admin', async () => {78 const createMode = 'NFT';79 const newCollectionID = await createCollectionWithPropsExpectSuccess({mode: {type: createMode}, 80 propPerm: [{key: 'k', permission: {mutable: true, collectionAdmin: true, tokenOwner: false}}]});81 82 await createItemWithPropsExpectSuccess(alice, newCollectionID, createMode, [{key: 'k', value: 't2'}]);83 });8485 it('Set property AdminConst', async () => {86 const createMode = 'NFT';87 const newCollectionID = await createCollectionWithPropsExpectSuccess({mode: {type: createMode}, 88 propPerm: [{key: 'key1', permission: {mutable: false, collectionAdmin: true, tokenOwner: false}}]});89 90 await createItemWithPropsExpectSuccess(alice, newCollectionID, createMode, [{key: 'key1', value: 'val1'}]);91 });9293 it('Set property itemOwnerOrAdmin', async () => {94 const createMode = 'NFT';95 const newCollectionID = await createCollectionWithPropsExpectSuccess({mode: {type: createMode},96 propPerm: [{key: 'key1', permission: {mutable: true, collectionAdmin: true, tokenOwner: true}}]});97 98 await createItemWithPropsExpectSuccess(alice, newCollectionID, createMode, [{key: 'key1', value: 'val1'}]);99 });100});101102describe('Negative integration test: ext. createItem():', () => {103 before(async () => {104 await usingApi(async () => {105 const keyring = new Keyring({type: 'sr25519'});106 alice = keyring.addFromUri('//Alice');107 bob = keyring.addFromUri('//Bob');108 });109 });110111 it('Regular user cannot create new item in NFT collection', async () => {112 const createMode = 'NFT';113 const newCollectionID = await createCollectionExpectSuccess({mode: {type: createMode}});114 await expect(createItemExpectSuccess(bob, newCollectionID, createMode)).to.be.rejected;115 });116 it('Regular user cannot create new item in Fungible collection', async () => {117 const createMode = 'Fungible';118 const newCollectionID = await createCollectionExpectSuccess({mode: {type: createMode, decimalPoints: 0}});119 await expect(createItemExpectSuccess(bob, newCollectionID, createMode)).to.be.rejected;120 });121 it('Regular user cannot create new item in ReFungible collection', async () => {122 const createMode = 'ReFungible';123 const newCollectionID = await createCollectionExpectSuccess({mode: {type: createMode}});124 await expect(createItemExpectSuccess(bob, newCollectionID, createMode)).to.be.rejected;125 });126127 it('No editing rights', async () => {128 await usingApi(async api => {129 const createMode = 'NFT';130 const newCollectionID = await createCollectionWithPropsExpectSuccess({mode: {type: createMode}, 131 propPerm: [{key: 'key1', permission: {mutable: false, collectionAdmin: false, tokenOwner: false}}]});132 await addCollectionAdminExpectSuccess(alice, newCollectionID, bob.address);133134 await createItemWithPropsExpectFailure(bob, newCollectionID, 'NFT', [{key: 'key1', value: 'v'}]);135 });136 });137138 it('User doesnt have editing rights', async () => {139 await usingApi(async api => {140 const newCollectionID = await createCollectionWithPropsExpectSuccess({propPerm: [{key: 'key1', permission: {mutable: true, collectionAdmin: false, tokenOwner: false}}]});141 await createItemWithPropsExpectFailure(bob, newCollectionID, 'NFT', [{key: 'key1', value: 'v'}]);142 });143 });144145 it('Adding property without access rights', async () => {146 await usingApi(async api => {147 const newCollectionID = await createCollectionWithPropsExpectSuccess();148 await addCollectionAdminExpectSuccess(alice, newCollectionID, bob.address);149150 await createItemWithPropsExpectFailure(bob, newCollectionID, 'NFT', [{key: 'k', value: 'v'}]);151 });152 });153154 it('Adding more than 64 prps', async () => {155 await usingApi(async api => {156 const prps = [];157158 for (let i = 0; i < 65; i++) {159 prps.push({key: `key${i}`, value: `value${i}`});160 }161162 const newCollectionID = await createCollectionWithPropsExpectSuccess();163 164 createItemWithPropsExpectFailure(alice, newCollectionID, 'NFT', prps);165 });166 });167168 it('Trying to add bigger property than allowed', async () => {169 await usingApi(async api => {170 const newCollectionID = await createCollectionWithPropsExpectSuccess();171 172 createItemWithPropsExpectFailure(alice, newCollectionID, 'NFT', [{key: 'k', value: 'vvvvvv'.repeat(5000)}, {key: 'k2', value: 'vvv'.repeat(5000)}]);173 });174 });175});1// Copyright 2019-2022 Unique Network (Gibraltar) Ltd.2// This file is part of Unique Network.34// Unique Network is free software: you can redistribute it and/or modify5// it under the terms of the GNU General Public License as published by6// the Free Software Foundation, either version 3 of the License, or7// (at your option) any later version.89// Unique Network is distributed in the hope that it will be useful,10// but WITHOUT ANY WARRANTY; without even the implied warranty of11// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the12// GNU General Public License for more details.1314// You should have received a copy of the GNU General Public License15// along with Unique Network. If not, see <http://www.gnu.org/licenses/>.1617import {default as usingApi} from './substrate/substrate-api';18import chai from 'chai';19import {Keyring} from '@polkadot/api';20import {IKeyringPair} from '@polkadot/types/types';21import {22 createCollectionExpectSuccess,23 createItemExpectSuccess,24 addCollectionAdminExpectSuccess,25 createCollectionWithPropsExpectSuccess,26 createItemWithPropsExpectSuccess,27 createItemWithPropsExpectFailure,28} from './util/helpers';2930const expect = chai.expect;31let alice: IKeyringPair;32let bob: IKeyringPair;3334describe('integration test: ext. ():', () => {35 before(async () => {36 await usingApi(async () => {37 const keyring = new Keyring({type: 'sr25519'});38 alice = keyring.addFromUri('//Alice');39 bob = keyring.addFromUri('//Bob');40 });41 });4243 it('Create new item in NFT collection', async () => {44 const createMode = 'NFT';45 const newCollectionID = await createCollectionExpectSuccess({mode: {type: createMode}});46 await createItemExpectSuccess(alice, newCollectionID, createMode);47 });48 it('Create new item in Fungible collection', async () => {49 const createMode = 'Fungible';50 const newCollectionID = await createCollectionExpectSuccess({mode: {type: createMode, decimalPoints: 0}});51 await createItemExpectSuccess(alice, newCollectionID, createMode);52 });53 it('Create new item in ReFungible collection', async () => {54 const createMode = 'ReFungible';55 const newCollectionID = await createCollectionExpectSuccess({mode: {type: createMode}});56 await createItemExpectSuccess(alice, newCollectionID, createMode);57 });58 it('Create new item in NFT collection with collection admin permissions', async () => {59 const createMode = 'NFT';60 const newCollectionID = await createCollectionExpectSuccess({mode: {type: createMode}});61 await addCollectionAdminExpectSuccess(alice, newCollectionID, bob.address);62 await createItemExpectSuccess(bob, newCollectionID, createMode);63 });64 it('Create new item in Fungible collection with collection admin permissions', async () => {65 const createMode = 'Fungible';66 const newCollectionID = await createCollectionExpectSuccess({mode: {type: createMode, decimalPoints: 0}});67 await addCollectionAdminExpectSuccess(alice, newCollectionID, bob.address);68 await createItemExpectSuccess(bob, newCollectionID, createMode);69 });70 it('Create new item in ReFungible collection with collection admin permissions', async () => {71 const createMode = 'ReFungible';72 const newCollectionID = await createCollectionExpectSuccess({mode: {type: createMode}});73 await addCollectionAdminExpectSuccess(alice, newCollectionID, bob.address);74 await createItemExpectSuccess(bob, newCollectionID, createMode);75 });7677 it('Set property Admin', async () => {78 const createMode = 'NFT';79 const newCollectionID = await createCollectionWithPropsExpectSuccess({mode: {type: createMode}, 80 propPerm: [{key: 'k', permission: {mutable: true, collectionAdmin: true, tokenOwner: false}}]});81 82 await createItemWithPropsExpectSuccess(alice, newCollectionID, createMode, [{key: 'k', value: 't2'}]);83 });8485 it('Set property AdminConst', async () => {86 const createMode = 'NFT';87 const newCollectionID = await createCollectionWithPropsExpectSuccess({mode: {type: createMode}, 88 propPerm: [{key: 'key1', permission: {mutable: false, collectionAdmin: true, tokenOwner: false}}]});89 90 await createItemWithPropsExpectSuccess(alice, newCollectionID, createMode, [{key: 'key1', value: 'val1'}]);91 });9293 it('Set property itemOwnerOrAdmin', async () => {94 const createMode = 'NFT';95 const newCollectionID = await createCollectionWithPropsExpectSuccess({mode: {type: createMode},96 propPerm: [{key: 'key1', permission: {mutable: true, collectionAdmin: true, tokenOwner: true}}]});97 98 await createItemWithPropsExpectSuccess(alice, newCollectionID, createMode, [{key: 'key1', value: 'val1'}]);99 });100});101102describe('Negative integration test: ext. createItem():', () => {103 before(async () => {104 await usingApi(async () => {105 const keyring = new Keyring({type: 'sr25519'});106 alice = keyring.addFromUri('//Alice');107 bob = keyring.addFromUri('//Bob');108 });109 });110111 it('Regular user cannot create new item in NFT collection', async () => {112 const createMode = 'NFT';113 const newCollectionID = await createCollectionExpectSuccess({mode: {type: createMode}});114 await expect(createItemExpectSuccess(bob, newCollectionID, createMode)).to.be.rejected;115 });116 it('Regular user cannot create new item in Fungible collection', async () => {117 const createMode = 'Fungible';118 const newCollectionID = await createCollectionExpectSuccess({mode: {type: createMode, decimalPoints: 0}});119 await expect(createItemExpectSuccess(bob, newCollectionID, createMode)).to.be.rejected;120 });121 it('Regular user cannot create new item in ReFungible collection', async () => {122 const createMode = 'ReFungible';123 const newCollectionID = await createCollectionExpectSuccess({mode: {type: createMode}});124 await expect(createItemExpectSuccess(bob, newCollectionID, createMode)).to.be.rejected;125 });126127 it('No editing rights', async () => {128 await usingApi(async () => {129 const createMode = 'NFT';130 const newCollectionID = await createCollectionWithPropsExpectSuccess({mode: {type: createMode}, 131 propPerm: [{key: 'key1', permission: {mutable: false, collectionAdmin: false, tokenOwner: false}}]});132 await addCollectionAdminExpectSuccess(alice, newCollectionID, bob.address);133134 await createItemWithPropsExpectFailure(bob, newCollectionID, 'NFT', [{key: 'key1', value: 'v'}]);135 });136 });137138 it('User doesnt have editing rights', async () => {139 await usingApi(async () => {140 const newCollectionID = await createCollectionWithPropsExpectSuccess({propPerm: [{key: 'key1', permission: {mutable: true, collectionAdmin: false, tokenOwner: false}}]});141 await createItemWithPropsExpectFailure(bob, newCollectionID, 'NFT', [{key: 'key1', value: 'v'}]);142 });143 });144145 it('Adding property without access rights', async () => {146 await usingApi(async () => {147 const newCollectionID = await createCollectionWithPropsExpectSuccess();148 await addCollectionAdminExpectSuccess(alice, newCollectionID, bob.address);149150 await createItemWithPropsExpectFailure(bob, newCollectionID, 'NFT', [{key: 'k', value: 'v'}]);151 });152 });153154 it('Adding more than 64 prps', async () => {155 await usingApi(async () => {156 const prps = [];157158 for (let i = 0; i < 65; i++) {159 prps.push({key: `key${i}`, value: `value${i}`});160 }161162 const newCollectionID = await createCollectionWithPropsExpectSuccess();163 164 createItemWithPropsExpectFailure(alice, newCollectionID, 'NFT', prps);165 });166 });167168 it('Trying to add bigger property than allowed', async () => {169 await usingApi(async () => {170 const newCollectionID = await createCollectionWithPropsExpectSuccess();171 172 createItemWithPropsExpectFailure(alice, newCollectionID, 'NFT', [{key: 'k', value: 'vvvvvv'.repeat(5000)}, {key: 'k2', value: 'vvv'.repeat(5000)}]);173 });174 });175});tests/src/createMultipleItems.test.tsdiffbeforeafterboth--- a/tests/src/createMultipleItems.test.ts
+++ b/tests/src/createMultipleItems.test.ts
@@ -49,13 +49,13 @@
const alice = privateKey('//Alice');
await submitTransactionAsync(
alice,
- api.tx.unique.setPropertyPermissions(collectionId, [{key: 'data', permission: {tokenOwner: true}}])
+ api.tx.unique.setPropertyPermissions(collectionId, [{key: 'data', permission: {tokenOwner: true}}]),
);
const args = [
{NFT: {properties: [{key: 'data', value: '1'}]}},
{NFT: {properties: [{key: 'data', value: '2'}]}},
- {NFT: {properties: [{key: 'data', value: '3'}]}}
+ {NFT: {properties: [{key: 'data', value: '3'}]}},
];
const createMultipleItemsTx = api.tx.unique.createMultipleItems(collectionId, normalizeAccountId(alice.address), args);
await submitTransactionAsync(alice, createMultipleItemsTx);
@@ -143,7 +143,7 @@
const args = [
{NFT: {properties: [{key: 'k', value: 'v1'}]}},
{NFT: {properties: [{key: 'k', value: 'v2'}]}},
- {NFT: {properties: [{key: 'k', value: 'v3'}]}}
+ {NFT: {properties: [{key: 'k', value: 'v3'}]}},
];
await createMultipleItemsWithPropsExpectSuccess(alice, collectionId, args);
@@ -171,7 +171,7 @@
const args = [
{NFT: {properties: [{key: 'k', value: 'v1'}]}},
{NFT: {properties: [{key: 'k', value: 'v2'}]}},
- {NFT: {properties: [{key: 'k', value: 'v3'}]}}
+ {NFT: {properties: [{key: 'k', value: 'v3'}]}},
];
await createMultipleItemsWithPropsExpectSuccess(alice, collectionId, args);
@@ -190,16 +190,14 @@
it('Create 0x31, 0x32, 0x33 items in active NFT with property itemOwnerOrAdmin', async () => {
await usingApi(async (api: ApiPromise) => {
- const collectionId = await createCollectionWithPropsExpectSuccess(
- {propPerm: [{key: 'k', permission: {mutable: true, collectionAdmin: true, tokenOwner: true}}]}
- );
+ const collectionId = await createCollectionWithPropsExpectSuccess({propPerm: [{key: 'k', permission: {mutable: true, collectionAdmin: true, tokenOwner: true}}]});
const itemsListIndexBefore = await getLastTokenId(api, collectionId);
expect(itemsListIndexBefore).to.be.equal(0);
const alice = privateKey('//Alice');
const args = [
{NFT: {properties: [{key: 'k', value: 'v1'}]}},
{NFT: {properties: [{key: 'k', value: 'v2'}]}},
- {NFT: {properties: [{key: 'k', value: 'v3'}]}}
+ {NFT: {properties: [{key: 'k', value: 'v3'}]}},
];
await createMultipleItemsWithPropsExpectSuccess(alice, collectionId, args);
@@ -230,16 +228,14 @@
it('Create 0x31, 0x32, 0x33 items in active NFT collection and verify tokens data in chain', async () => {
await usingApi(async (api: ApiPromise) => {
- const collectionId = await createCollectionWithPropsExpectSuccess(
- {propPerm: [{key: 'data', permission: {mutable: true, collectionAdmin: true, tokenOwner: true}}]}
- );
+ const collectionId = await createCollectionWithPropsExpectSuccess({propPerm: [{key: 'data', permission: {mutable: true, collectionAdmin: true, tokenOwner: true}}]});
const itemsListIndexBefore = await getLastTokenId(api, collectionId);
expect(itemsListIndexBefore).to.be.equal(0);
await addCollectionAdminExpectSuccess(alice, collectionId, bob.address);
const args = [
{NFT: {properties: [{key: 'data', value: 'v1'}]}},
{NFT: {properties: [{key: 'data', value: 'v2'}]}},
- {NFT: {properties: [{key: 'data', value: 'v3'}]}}
+ {NFT: {properties: [{key: 'data', value: 'v3'}]}},
];
const createMultipleItemsTx = api.tx.unique
.createMultipleItems(collectionId, normalizeAccountId(bob.address), args);
@@ -358,9 +354,7 @@
it('Create token in not existing collection', async () => {
await usingApi(async (api: ApiPromise) => {
const collectionId = await getCreatedCollectionCount(api) + 1;
- const createMultipleItemsTx = api.tx.unique.createMultipleItems(
- collectionId, normalizeAccountId(alice.address), ['NFT', 'NFT', 'NFT']
- );
+ const createMultipleItemsTx = api.tx.unique.createMultipleItems(collectionId, normalizeAccountId(alice.address), ['NFT', 'NFT', 'NFT']);
await expect(executeTransaction(api, alice, createMultipleItemsTx)).to.be.rejectedWith(/common\.CollectionNotFound/);
});
});
@@ -369,7 +363,7 @@
await usingApi(async (api: ApiPromise) => {
// NFT
const collectionId = await createCollectionWithPropsExpectSuccess({
- propPerm: [{key: 'key', permission: {mutable: true, collectionAdmin: true, tokenOwner: true}}]
+ propPerm: [{key: 'key', permission: {mutable: true, collectionAdmin: true, tokenOwner: true}}],
});
const alice = privateKey('//Alice');
const args = [
@@ -399,11 +393,7 @@
const collectionId = await createCollectionExpectSuccess();
const createMultipleItemsTx = api.tx.unique
.createMultipleItems(collectionId, normalizeAccountId(alice.address), ['NFT', 'Fungible', 'ReFungible']);
- await expect(
- executeTransaction(api, alice, createMultipleItemsTx)
- ).to.be.rejectedWith(
- /nonfungible\.NotNonfungibleDataUsedToMintFungibleCollectionToken/
- );
+ await expect(executeTransaction(api, alice, createMultipleItemsTx)).to.be.rejectedWith(/nonfungible\.NotNonfungibleDataUsedToMintFungibleCollectionToken/);
// garbage collection :-D // lol
await destroyCollectionExpectSuccess(collectionId);
});
@@ -412,7 +402,7 @@
it('Create tokens with different data limits <> maximum data limit', async () => {
await usingApi(async (api: ApiPromise) => {
const collectionId = await createCollectionWithPropsExpectSuccess({
- propPerm: [{key: 'key', permission: {mutable: true, collectionAdmin: true, tokenOwner: true}}]
+ propPerm: [{key: 'key', permission: {mutable: true, collectionAdmin: true, tokenOwner: true}}],
});
const args = [
{NFT: {properties: [{key: 'key', value: 'A'}]}},
@@ -441,7 +431,7 @@
it('User doesnt have editing rights', async () => {
await usingApi(async (api: ApiPromise) => {
const collectionId = await createCollectionWithPropsExpectSuccess({
- propPerm: [{key: 'key1', permission: {mutable: true, collectionAdmin: false, tokenOwner: false}}]
+ propPerm: [{key: 'key1', permission: {mutable: true, collectionAdmin: false, tokenOwner: false}}],
});
const itemsListIndexBefore = await getLastTokenId(api, collectionId);
expect(itemsListIndexBefore).to.be.equal(0);
@@ -449,7 +439,7 @@
const args = [
{NFT: {properties: [{key: 'key1', value: 'v2'}]}},
{NFT: {}},
- {NFT: {}}
+ {NFT: {}},
];
const tx = api.tx.unique.createMultipleItems(collectionId, normalizeAccountId(bob.address), args);
@@ -497,11 +487,11 @@
const args = [
{NFT: {properties: prps}},
{NFT: {properties: prps}},
- {NFT: {properties: prps}}
+ {NFT: {properties: prps}},
];
// there are no permissions, but will fail anyway because of too much weight for a block
- const tx2 = api.tx.unique.createMultipleItems(collectionId, normalizeAccountId(alice.address), args);;
+ const tx2 = api.tx.unique.createMultipleItems(collectionId, normalizeAccountId(alice.address), args);
await expect(submitTransactionExpectFailAsync(alice, tx2)).to.be.rejected;
});
});
@@ -509,7 +499,7 @@
it('Trying to add bigger property than allowed', async () => {
await usingApi(async (api: ApiPromise) => {
const collectionId = await createCollectionWithPropsExpectSuccess({
- propPerm: [{key: 'k', permission: {mutable: true, collectionAdmin: true, tokenOwner: true}}]
+ propPerm: [{key: 'k', permission: {mutable: true, collectionAdmin: true, tokenOwner: true}}],
});
const itemsListIndexBefore = await getLastTokenId(api, collectionId);
expect(itemsListIndexBefore).to.be.equal(0);
tests/src/createMultipleItemsEx.test.tsdiffbeforeafterboth--- a/tests/src/createMultipleItemsEx.test.ts
+++ b/tests/src/createMultipleItemsEx.test.ts
@@ -16,8 +16,8 @@
import {expect} from 'chai';
import privateKey from './substrate/privateKey';
-import usingApi, {executeTransaction, submitTransactionAsync, submitTransactionExpectFailAsync} from './substrate/substrate-api';
-import {createCollectionExpectSuccess, createCollectionWithPropsExpectSuccess, addCollectionAdminExpectSuccess, getCreateItemsResult} from './util/helpers';
+import usingApi, {executeTransaction} from './substrate/substrate-api';
+import {createCollectionExpectSuccess, createCollectionWithPropsExpectSuccess, addCollectionAdminExpectSuccess} from './util/helpers';
describe('createMultipleItemsEx', () => {
it('can initialize multiple NFT with different owners', async () => {
@@ -175,7 +175,6 @@
propPerm: [{key: 'key1', permission: {mutable: false, collectionAdmin: false, tokenOwner: false}}]});
const alice = privateKey('//Alice');
const bob = privateKey('//Bob');
- const charlie = privateKey('//Charlie');
await addCollectionAdminExpectSuccess(alice, collection, bob.address);
await usingApi(async (api) => {
const data = [
@@ -236,9 +235,7 @@
const alice = privateKey('//Alice');
const collection = await createCollectionExpectSuccess({mode: {type: 'NFT'}});
await usingApi(async (api) => {
- await expect(
- executeTransaction(api, alice, api.tx.unique.setPropertyPermissions(collection, propPerms))
- ).to.be.rejectedWith(/common\.PropertyLimitReached/);
+ await expect(executeTransaction(api, alice, api.tx.unique.setPropertyPermissions(collection, propPerms))).to.be.rejectedWith(/common\.PropertyLimitReached/);
});
});
tests/src/util/helpers.tsdiffbeforeafterboth--- a/tests/src/util/helpers.ts
+++ b/tests/src/util/helpers.ts
@@ -347,7 +347,7 @@
name: strToUTF16(name),
description: strToUTF16(description),
tokenPrefix: strToUTF16(tokenPrefix),
- mode: modeprm as any
+ mode: modeprm as any,
});
const events = await submitTransactionAsync(alicePrivateKey, tx);
const result = getCreateCollectionResult(events);
@@ -561,7 +561,7 @@
expect(result.success).to.be.true;
});
-}
+};
export async function setCollectionLimitsExpectFailure(sender: IKeyringPair, collectionId: number, limits: any) {
await usingApi(async (api) => {