difftreelog
test fix eslint warnings
in: master
4 files changed
tests/src/createItem.test.tsdiffbeforeafterboth14// You should have received a copy of the GNU General Public License14// You should have received a copy of the GNU General Public License15// along with Unique Network. If not, see <http://www.gnu.org/licenses/>.15// along with Unique Network. If not, see <http://www.gnu.org/licenses/>.161617import {default as usingApi, executeTransaction} from './substrate/substrate-api';17import {default as usingApi} from './substrate/substrate-api';18import chai from 'chai';18import chai from 'chai';19import {Keyring} from '@polkadot/api';19import {Keyring} from '@polkadot/api';20import {IKeyringPair} from '@polkadot/types/types';20import {IKeyringPair} from '@polkadot/types/types';125 });125 });126126127 it('No editing rights', async () => {127 it('No editing rights', async () => {128 await usingApi(async api => {128 await usingApi(async () => {129 const createMode = 'NFT';129 const createMode = 'NFT';130 const newCollectionID = await createCollectionWithPropsExpectSuccess({mode: {type: createMode}, 130 const newCollectionID = await createCollectionWithPropsExpectSuccess({mode: {type: createMode}, 131 propPerm: [{key: 'key1', permission: {mutable: false, collectionAdmin: false, tokenOwner: false}}]});131 propPerm: [{key: 'key1', permission: {mutable: false, collectionAdmin: false, tokenOwner: false}}]});136 });136 });137137138 it('User doesnt have editing rights', async () => {138 it('User doesnt have editing rights', async () => {139 await usingApi(async api => {139 await usingApi(async () => {140 const newCollectionID = await createCollectionWithPropsExpectSuccess({propPerm: [{key: 'key1', permission: {mutable: true, collectionAdmin: false, tokenOwner: false}}]});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'}]);141 await createItemWithPropsExpectFailure(bob, newCollectionID, 'NFT', [{key: 'key1', value: 'v'}]);142 });142 });143 });143 });144144145 it('Adding property without access rights', async () => {145 it('Adding property without access rights', async () => {146 await usingApi(async api => {146 await usingApi(async () => {147 const newCollectionID = await createCollectionWithPropsExpectSuccess();147 const newCollectionID = await createCollectionWithPropsExpectSuccess();148 await addCollectionAdminExpectSuccess(alice, newCollectionID, bob.address);148 await addCollectionAdminExpectSuccess(alice, newCollectionID, bob.address);149149152 });152 });153153154 it('Adding more than 64 prps', async () => {154 it('Adding more than 64 prps', async () => {155 await usingApi(async api => {155 await usingApi(async () => {156 const prps = [];156 const prps = [];157157158 for (let i = 0; i < 65; i++) {158 for (let i = 0; i < 65; i++) {166 });166 });167167168 it('Trying to add bigger property than allowed', async () => {168 it('Trying to add bigger property than allowed', async () => {169 await usingApi(async api => {169 await usingApi(async () => {170 const newCollectionID = await createCollectionWithPropsExpectSuccess();170 const newCollectionID = await createCollectionWithPropsExpectSuccess();171 171 172 createItemWithPropsExpectFailure(alice, newCollectionID, 'NFT', [{key: 'k', value: 'vvvvvv'.repeat(5000)}, {key: 'k2', value: 'vvv'.repeat(5000)}]);172 createItemWithPropsExpectFailure(alice, newCollectionID, 'NFT', [{key: 'k', value: 'vvvvvv'.repeat(5000)}, {key: 'k2', value: 'vvv'.repeat(5000)}]);tests/src/createMultipleItems.test.tsdiffbeforeafterboth501 ];491 ];502492503 // there are no permissions, but will fail anyway because of too much weight for a block493 // there are no permissions, but will fail anyway because of too much weight for a block504 const tx2 = api.tx.unique.createMultipleItems(collectionId, normalizeAccountId(alice.address), args);;494 const tx2 = api.tx.unique.createMultipleItems(collectionId, normalizeAccountId(alice.address), args);505 await expect(submitTransactionExpectFailAsync(alice, tx2)).to.be.rejected;495 await expect(submitTransactionExpectFailAsync(alice, tx2)).to.be.rejected;506 });496 });507 });497 });tests/src/createMultipleItemsEx.test.tsdiffbeforeafterboth161617import {expect} from 'chai';17import {expect} from 'chai';18import privateKey from './substrate/privateKey';18import privateKey from './substrate/privateKey';19import usingApi, {executeTransaction, submitTransactionAsync, submitTransactionExpectFailAsync} from './substrate/substrate-api';19import usingApi, {executeTransaction} from './substrate/substrate-api';20import {createCollectionExpectSuccess, createCollectionWithPropsExpectSuccess, addCollectionAdminExpectSuccess, getCreateItemsResult} from './util/helpers';20import {createCollectionExpectSuccess, createCollectionWithPropsExpectSuccess, addCollectionAdminExpectSuccess} from './util/helpers';212122describe('createMultipleItemsEx', () => {22describe('createMultipleItemsEx', () => {23 it('can initialize multiple NFT with different owners', async () => {23 it('can initialize multiple NFT with different owners', async () => {175 propPerm: [{key: 'key1', permission: {mutable: false, collectionAdmin: false, tokenOwner: false}}]});175 propPerm: [{key: 'key1', permission: {mutable: false, collectionAdmin: false, tokenOwner: false}}]});176 const alice = privateKey('//Alice');176 const alice = privateKey('//Alice');177 const bob = privateKey('//Bob');177 const bob = privateKey('//Bob');178 const charlie = privateKey('//Charlie');179 await addCollectionAdminExpectSuccess(alice, collection, bob.address);178 await addCollectionAdminExpectSuccess(alice, collection, bob.address);180 await usingApi(async (api) => {179 await usingApi(async (api) => {181 const data = [180 const data = [tests/src/util/helpers.tsdiffbeforeafterboth561561562 expect(result.success).to.be.true;562 expect(result.success).to.be.true;563 });563 });564}564};565565566export async function setCollectionLimitsExpectFailure(sender: IKeyringPair, collectionId: number, limits: any) {566export async function setCollectionLimitsExpectFailure(sender: IKeyringPair, collectionId: number, limits: any) {567 await usingApi(async (api) => {567 await usingApi(async (api) => {