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.tsdiffbeforeafterboth--- a/tests/src/setSchemaVersion.test.ts
+++ b/tests/src/setSchemaVersion.test.ts
@@ -4,7 +4,7 @@
import BN from 'bn.js';
import chai from 'chai';
import chaiAsPromised from 'chai-as-promised';
-import usingApi, { submitTransactionAsync } from './substrate/substrate-api';
+import usingApi, {submitTransactionAsync, submitTransactionExpectFailAsync} from './substrate/substrate-api';
import { ICollectionInterface } from './types';
import {
createCollectionExpectSuccess,
@@ -92,12 +92,13 @@
const collectionCount = await getCreatedCollectionCount(api);
const nonExistedCollectionId = collectionCount + 1;
tx = api.tx.nft.setSchemaVersion(nonExistedCollectionId, 'ImageURL');
- try {
+ await expect(submitTransactionExpectFailAsync(alice, tx)).to.be.rejected;
+ /*try {
await submitTransactionAsync(alice, tx);
} catch (e) {
// tslint:disable-next-line:no-unused-expression
expect(e).to.be.exist;
- }
+ }*/
});
});
@@ -116,13 +117,15 @@
it('execute setSchemaVersion for deleted collection', async () => {
await usingApi(async (api: ApiPromise) => {
await destroyCollectionExpectSuccess(collectionIdForTesting);
- try {
+ tx = api.tx.nft.setSchemaVersion(collectionIdForTesting, 'ImageURL');
+ await expect(submitTransactionExpectFailAsync(alice, tx)).to.be.rejected;
+ /*try {
tx = api.tx.nft.setSchemaVersion(collectionIdForTesting, 'ImageURL');
await submitTransactionAsync(alice, tx);
} catch (e) {
// tslint:disable-next-line:no-unused-expression
expect(e).to.be.exist;
- }
+ }*/
});
});
});