git.delta.rocks / unique-network / refs/commits / 67ac05174e08

difftreelog

test fix eslint warnings

Yaroslav Bolyukin2022-05-30parent: #4eba81a.patch.diff
in: master

4 files changed

modifiedtests/src/createItem.test.tsdiffbeforeafterboth
--- a/tests/src/createItem.test.ts
+++ b/tests/src/createItem.test.ts
@@ -14,7 +14,7 @@
 // You should have received a copy of the GNU General Public License
 // along with Unique Network. If not, see <http://www.gnu.org/licenses/>.
 
-import {default as usingApi, executeTransaction} from './substrate/substrate-api';
+import {default as usingApi} from './substrate/substrate-api';
 import chai from 'chai';
 import {Keyring} from '@polkadot/api';
 import {IKeyringPair} from '@polkadot/types/types';
@@ -125,7 +125,7 @@
   });
 
   it('No editing rights', async () => {
-    await usingApi(async api => {
+    await usingApi(async () => {
       const createMode = 'NFT';
       const newCollectionID = await createCollectionWithPropsExpectSuccess({mode: {type: createMode}, 
         propPerm:   [{key: 'key1', permission: {mutable: false, collectionAdmin: false, tokenOwner: false}}]});
@@ -136,14 +136,14 @@
   });
 
   it('User doesnt have editing rights', async () => {
-    await usingApi(async api => {
+    await usingApi(async () => {
       const newCollectionID = await createCollectionWithPropsExpectSuccess({propPerm: [{key: 'key1', permission: {mutable: true, collectionAdmin: false, tokenOwner: false}}]});
       await createItemWithPropsExpectFailure(bob, newCollectionID, 'NFT', [{key: 'key1', value: 'v'}]);
     });
   });
 
   it('Adding property without access rights', async () => {
-    await usingApi(async api => {
+    await usingApi(async () => {
       const newCollectionID = await createCollectionWithPropsExpectSuccess();
       await addCollectionAdminExpectSuccess(alice, newCollectionID, bob.address);
 
@@ -152,7 +152,7 @@
   });
 
   it('Adding more than 64 prps', async () => {
-    await usingApi(async api => {
+    await usingApi(async () => {
       const prps = [];
 
       for (let i = 0; i < 65; i++) {
@@ -166,7 +166,7 @@
   });
 
   it('Trying to add bigger property than allowed', async () => {
-    await usingApi(async api => {
+    await usingApi(async () => {
       const newCollectionID = await createCollectionWithPropsExpectSuccess();
       
       createItemWithPropsExpectFailure(alice, newCollectionID, 'NFT', [{key: 'k', value: 'vvvvvv'.repeat(5000)}, {key: 'k2', value: 'vvv'.repeat(5000)}]);
modifiedtests/src/createMultipleItems.test.tsdiffbeforeafterboth
501 ];491 ];
502492
503 // 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 block
504 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 });
modifiedtests/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/);
     });
   });
 
modifiedtests/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) => {