git.delta.rocks / unique-network / refs/commits / 5d16a7495f50

difftreelog

test add missing awaits

Yaroslav Bolyukin2021-09-08parent: #d221bab.patch.diff
in: master

2 files changed

modifiedtests/src/collision-tests/adminLimitsOff.test.tsdiffbeforeafterboth
--- a/tests/src/collision-tests/adminLimitsOff.test.ts
+++ b/tests/src/collision-tests/adminLimitsOff.test.ts
@@ -53,8 +53,7 @@
       ]);
       await timeoutPromise(10000);
       const changeAdminTx4 = api.tx.nft.addCollectionAdmin(collectionId, Alice.address);
-      // tslint:disable-next-line: no-unused-expression
-      expect(submitTransactionExpectFailAsync(Alice, changeAdminTx4)).to.be.rejected;
+      await expect(submitTransactionExpectFailAsync(Alice, changeAdminTx4)).to.be.rejected;
 
       const adminListAfterAddAdmin: any = (await api.query.nft.adminList(collectionId));
       expect(adminListAfterAddAdmin).to.be.contains(Eve.address);
modifiedtests/src/createCollection.test.tsdiffbeforeafterboth
before · tests/src/createCollection.test.ts
1//2// This file is subject to the terms and conditions defined in3// file 'LICENSE', which is part of this source code package.4//56import chai from 'chai';7import chaiAsPromised from 'chai-as-promised';8import { default as usingApi } from './substrate/substrate-api';9import { createCollectionExpectFailure, createCollectionExpectSuccess } from './util/helpers';1011chai.use(chaiAsPromised);12const expect = chai.expect;1314describe('integration test: ext. createCollection():', () => {15  it('Create new NFT collection', async () => {16    await createCollectionExpectSuccess({name: 'A', description: 'B', tokenPrefix: 'C', mode: {type: 'NFT'}});17  });18  it('Create new NFT collection whith collection_name of maximum length (64 bytes)', async () => {19    await createCollectionExpectSuccess({name: 'A'.repeat(64)});20  });21  it('Create new NFT collection whith collection_description of maximum length (256 bytes)', async () => {22    await createCollectionExpectSuccess({description: 'A'.repeat(256)});23  });24  it('Create new NFT collection whith token_prefix of maximum length (16 bytes)', async () => {25    await createCollectionExpectSuccess({tokenPrefix: 'A'.repeat(16)});26  });27  it('Create new Fungible collection', async () => {28    await createCollectionExpectSuccess({mode: {type: 'Fungible', decimalPoints: 0}});29  });30  it('Create new ReFungible collection', async () => {31    await createCollectionExpectSuccess({mode: {type: 'ReFungible'}});32  });33});3435describe('(!negative test!) integration test: ext. createCollection():', () => {36  it('(!negative test!) create new NFT collection whith incorrect data (mode)', async () => {37    await usingApi(async (api) => {38      const AcollectionCount = parseInt((await api.query.nft.createdCollectionCount()).toString(), 10);3940      const badTransaction = async () => {41        await createCollectionExpectSuccess({mode: {type: 'Invalid'}});42      };43      // tslint:disable-next-line:no-unused-expression44      expect(badTransaction()).to.be.rejected;4546      const BcollectionCount = parseInt((await api.query.nft.createdCollectionCount()).toString(), 10);47      expect(BcollectionCount).to.be.equal(AcollectionCount, 'Error: Incorrect collection created.');48    });49  });50  it('(!negative test!) create new NFT collection whith incorrect data (collection_name)', async () => {51    await createCollectionExpectFailure({ name: 'A'.repeat(65), mode: {type: 'NFT'}});52  });53  it('(!negative test!) create new NFT collection whith incorrect data (collection_description)', async () => {54    await createCollectionExpectFailure({ description: 'A'.repeat(257), mode: { type: 'NFT' }});55  });56  it('(!negative test!) create new NFT collection whith incorrect data (token_prefix)', async () => {57    await createCollectionExpectFailure({tokenPrefix: 'A'.repeat(17), mode: {type: 'NFT'}});58  });59});
after · tests/src/createCollection.test.ts
1//2// This file is subject to the terms and conditions defined in3// file 'LICENSE', which is part of this source code package.4//56import chai from 'chai';7import chaiAsPromised from 'chai-as-promised';8import { default as usingApi } from './substrate/substrate-api';9import { createCollectionExpectFailure, createCollectionExpectSuccess } from './util/helpers';1011chai.use(chaiAsPromised);12const expect = chai.expect;1314describe('integration test: ext. createCollection():', () => {15  it('Create new NFT collection', async () => {16    await createCollectionExpectSuccess({name: 'A', description: 'B', tokenPrefix: 'C', mode: {type: 'NFT'}});17  });18  it('Create new NFT collection whith collection_name of maximum length (64 bytes)', async () => {19    await createCollectionExpectSuccess({name: 'A'.repeat(64)});20  });21  it('Create new NFT collection whith collection_description of maximum length (256 bytes)', async () => {22    await createCollectionExpectSuccess({description: 'A'.repeat(256)});23  });24  it('Create new NFT collection whith token_prefix of maximum length (16 bytes)', async () => {25    await createCollectionExpectSuccess({tokenPrefix: 'A'.repeat(16)});26  });27  it('Create new Fungible collection', async () => {28    await createCollectionExpectSuccess({mode: {type: 'Fungible', decimalPoints: 0}});29  });30  it('Create new ReFungible collection', async () => {31    await createCollectionExpectSuccess({mode: {type: 'ReFungible'}});32  });33});3435describe('(!negative test!) integration test: ext. createCollection():', () => {36  it('(!negative test!) create new NFT collection whith incorrect data (mode)', async () => {37    await usingApi(async (api) => {38      const AcollectionCount = parseInt((await api.query.nft.createdCollectionCount()).toString(), 10);3940      const badTransaction = async () => {41        await createCollectionExpectSuccess({mode: {type: 'Invalid'}});42      };43      await expect(badTransaction()).to.be.rejected;4445      const BcollectionCount = parseInt((await api.query.nft.createdCollectionCount()).toString(), 10);46      expect(BcollectionCount).to.be.equal(AcollectionCount, 'Error: Incorrect collection created.');47    });48  });49  it('(!negative test!) create new NFT collection whith incorrect data (collection_name)', async () => {50    await createCollectionExpectFailure({ name: 'A'.repeat(65), mode: {type: 'NFT'}});51  });52  it('(!negative test!) create new NFT collection whith incorrect data (collection_description)', async () => {53    await createCollectionExpectFailure({ description: 'A'.repeat(257), mode: { type: 'NFT' }});54  });55  it('(!negative test!) create new NFT collection whith incorrect data (token_prefix)', async () => {56    await createCollectionExpectFailure({tokenPrefix: 'A'.repeat(17), mode: {type: 'NFT'}});57  });58});