difftreelog
tests fixes
in: master
2 files changed
tests/src/setCollectionLimits.test.tsdiffbeforeafterboth3import { IKeyringPair } from '@polkadot/types/types';3import { IKeyringPair } from '@polkadot/types/types';4import chai from 'chai';4import chai from 'chai';5import chaiAsPromised from 'chai-as-promised';5import chaiAsPromised from 'chai-as-promised';6import usingApi, { submitTransactionAsync } from './substrate/substrate-api';6import usingApi, {submitTransactionAsync, submitTransactionExpectFailAsync} from './substrate/substrate-api';7import { ICollectionInterface } from './types';7import { ICollectionInterface } from './types';8import {8import {9 createCollectionExpectSuccess, getCreatedCollectionCount,9 createCollectionExpectSuccess, getCreatedCollectionCount,33 it('choose or create collection for testing', async () => {33 it('choose or create collection for testing', async () => {34 await usingApi(async () => {34 await usingApi(async () => {35 collectionIdForTesting = await createCollectionExpectSuccess({name: 'A', description: 'B', tokenPrefix: 'C', mode: 'NFT'});35 collectionIdForTesting = await createCollectionExpectSuccess({name: 'A', description: 'B', tokenPrefix: 'C', mode: 'NFT'});36 console.log('collectionIdForTesting', collectionIdForTesting);37 });36 });38 });37 });39});38});96 tokenLimit,95 tokenLimit,97 },96 },98 );97 );99 try {100 await submitTransactionAsync(alice, tx);101 } catch (e) {102 // tslint:disable-next-line:no-unused-expression103 expect(e).to.be.exist;98 await expect(submitTransactionExpectFailAsync(alice, tx)).to.be.rejected;104 }105 });99 });106 });100 });107 it('execute setCollectionLimits from user who is not owner of this collection', async () => {101 it('execute setCollectionLimits from user who is not owner of this collection', async () => {115 tokenLimit,109 tokenLimit,116 },110 },117 );111 );118 try {119 await submitTransactionAsync(bob, tx);120 } catch (e) {121 // tslint:disable-next-line:no-unused-expression122 expect(e).to.be.exist;112 await expect(submitTransactionExpectFailAsync(bob, tx)).to.be.rejected;123 }124 });113 });125 });114 });126 it('execute setCollectionLimits with incorrect limits', async () => {115 it('execute setCollectionLimits with incorrect limits', async () => {134 tokenLimit: '-100',123 tokenLimit: '-100',135 },124 },136 );125 );137 try {138 await submitTransactionAsync(alice, tx);139 } catch (e) {140 // tslint:disable-next-line:no-unused-expression141 expect(e).to.be.exist;126 await expect(submitTransactionExpectFailAsync(alice, tx)).to.be.rejected;142 }143 });127 });144 });128 });145});129});tests/src/setSchemaVersion.test.tsdiffbeforeafterboth4import BN from 'bn.js';4import BN from 'bn.js';5import chai from 'chai';5import chai from 'chai';6import chaiAsPromised from 'chai-as-promised';6import chaiAsPromised from 'chai-as-promised';7import usingApi, { submitTransactionAsync } from './substrate/substrate-api';7import usingApi, {submitTransactionAsync, submitTransactionExpectFailAsync} from './substrate/substrate-api';8import { ICollectionInterface } from './types';8import { ICollectionInterface } from './types';9import {9import {10 createCollectionExpectSuccess,10 createCollectionExpectSuccess,92 const collectionCount = await getCreatedCollectionCount(api);92 const collectionCount = await getCreatedCollectionCount(api);93 const nonExistedCollectionId = collectionCount + 1;93 const nonExistedCollectionId = collectionCount + 1;94 tx = api.tx.nft.setSchemaVersion(nonExistedCollectionId, 'ImageURL');94 tx = api.tx.nft.setSchemaVersion(nonExistedCollectionId, 'ImageURL');95 try {96 await submitTransactionAsync(alice, tx);97 } catch (e) {98 // tslint:disable-next-line:no-unused-expression99 expect(e).to.be.exist;95 await expect(submitTransactionExpectFailAsync(alice, tx)).to.be.rejected;100 }96 /*try {97 await submitTransactionAsync(alice, tx);98 } catch (e) {99 // tslint:disable-next-line:no-unused-expression100 expect(e).to.be.exist;101 }*/101 });102 });102 });103 });103104116 it('execute setSchemaVersion for deleted collection', async () => {117 it('execute setSchemaVersion for deleted collection', async () => {117 await usingApi(async (api: ApiPromise) => {118 await usingApi(async (api: ApiPromise) => {118 await destroyCollectionExpectSuccess(collectionIdForTesting);119 await destroyCollectionExpectSuccess(collectionIdForTesting);119 try {120 tx = api.tx.nft.setSchemaVersion(collectionIdForTesting, 'ImageURL');120 tx = api.tx.nft.setSchemaVersion(collectionIdForTesting, 'ImageURL');121 await submitTransactionAsync(alice, tx);122 } catch (e) {123 // tslint:disable-next-line:no-unused-expression124 expect(e).to.be.exist;121 await expect(submitTransactionExpectFailAsync(alice, tx)).to.be.rejected;125 }122 /*try {123 tx = api.tx.nft.setSchemaVersion(collectionIdForTesting, 'ImageURL');124 await submitTransactionAsync(alice, tx);125 } catch (e) {126 // tslint:disable-next-line:no-unused-expression127 expect(e).to.be.exist;128 }*/126 });129 });127 });130 });128});131});