git.delta.rocks / unique-network / refs/commits / 5811ea85a5fa

difftreelog

fmt

Trubnikov Sergey2022-12-09parent: #1a0647e.patch.diff
in: master

5 files changed

modifiedtests/src/eth/collectionSponsoring.test.tsdiffbeforeafterboth
--- a/tests/src/eth/collectionSponsoring.test.ts
+++ b/tests/src/eth/collectionSponsoring.test.ts
@@ -161,19 +161,17 @@
       {
         const result = await collectionEvm.methods.mintWithTokenURI(user, 'Test URI').send({from: user});
         const event = helper.eth.normalizeEvents(result.events)
-        .find(event => event.event === 'Transfer');;
+          .find(event => event.event === 'Transfer');
   
-        expect(event).to.be.deep.equal(
-          {
-            address: collectionAddress,
-            event: 'Transfer',
-            args: {
-              from: '0x0000000000000000000000000000000000000000',
-              to: user,
-              tokenId: '1',
-            },
+        expect(event).to.be.deep.equal({
+          address: collectionAddress,
+          event: 'Transfer',
+          args: {
+            from: '0x0000000000000000000000000000000000000000',
+            to: user,
+            tokenId: '1',
           },
-        );
+        });
   
         const ownerBalanceAfter = await helper.balance.getSubstrate(helper.address.ethToSubstrate(owner));
         const sponsorBalanceAfter = await helper.balance.getSubstrate(helper.address.ethToSubstrate(sponsorEth));
@@ -276,20 +274,18 @@
       const tokenId = mintingResult.events.Transfer.returnValues.tokenId;
   
       const event = helper.eth.normalizeEvents(mintingResult.events)
-      .find(event => event.event === 'Transfer');
+        .find(event => event.event === 'Transfer');
       const address = helper.ethAddress.fromCollectionId(collectionId);
   
-      expect(event).to.be.deep.equal(
-        {
-          address,
-          event: 'Transfer',
-          args: {
-            from: '0x0000000000000000000000000000000000000000',
-            to: user,
-            tokenId: '1',
-          },
+      expect(event).to.be.deep.equal({
+        address,
+        event: 'Transfer',
+        args: {
+          from: '0x0000000000000000000000000000000000000000',
+          to: user,
+          tokenId: '1',
         },
-      );
+      });
       expect(await collectionEvm.methods.tokenURI(tokenId).call({from: user})).to.be.equal('Test URI');
   
       const ownerBalanceAfter = await helper.balance.getSubstrate(helper.address.ethToSubstrate(owner));
modifiedtests/src/eth/events.test.tsdiffbeforeafterboth
47 }47 }
48 {48 {
49 const collectionHelper = helper.ethNativeContract.collectionHelpers(owner);49 const collectionHelper = helper.ethNativeContract.collectionHelpers(owner);
50 let result = await collectionHelper.methods.destroyCollection(collectionAddress).send({from:owner});50 const result = await collectionHelper.methods.destroyCollection(collectionAddress).send({from:owner});
51 expect(result.events).to.be.like({51 expect(result.events).to.be.like({
52 CollectionDestroyed: {52 CollectionDestroyed: {
53 returnValues: {53 returnValues: {
66 const collection = await helper.ethNativeContract.collection(collectionAddress, mode, owner);66 const collection = await helper.ethNativeContract.collection(collectionAddress, mode, owner);
67 const collectionHelper = helper.ethNativeContract.collectionHelpers(owner);67 const collectionHelper = helper.ethNativeContract.collectionHelpers(owner);
68 68
69 let {unsubscribe, collectedEvents: subEvents} = await helper.subscribeEvents([{section: 'common', names: ['CollectionPropertySet', 'CollectionPropertyDeleted']}]);69 const {unsubscribe, collectedEvents: subEvents} = await helper.subscribeEvents([{section: 'common', names: ['CollectionPropertySet', 'CollectionPropertyDeleted']}]);
70 {70 {
71 const ethEvents: any = [];71 const ethEvents: any = [];
72 collectionHelper.events.allEvents((_: any, event: any) => {72 collectionHelper.events.allEvents((_: any, event: any) => {
modifiedtests/src/eth/proxy/nonFungibleProxy.test.tsdiffbeforeafterboth
--- a/tests/src/eth/proxy/nonFungibleProxy.test.ts
+++ b/tests/src/eth/proxy/nonFungibleProxy.test.ts
@@ -121,17 +121,15 @@
         .find(event => event.event === 'Transfer')!;
       event.address = event.address.toLocaleLowerCase();
 
-      expect(event).to.be.deep.equal(
-        {
-          address: collectionAddress.toLocaleLowerCase(),
-          event: 'Transfer',
-          args: {
-            from: '0x0000000000000000000000000000000000000000',
-            to: receiver,
-            tokenId,
-          },
+      expect(event).to.be.deep.equal({
+        address: collectionAddress.toLocaleLowerCase(),
+        event: 'Transfer',
+        args: {
+          from: '0x0000000000000000000000000000000000000000',
+          to: receiver,
+          tokenId,
         },
-      );
+      });
 
       expect(await contract.methods.tokenURI(tokenId).call()).to.be.equal('Test URI');
     }
@@ -159,17 +157,15 @@
         .find(event => event.event === 'Transfer')!;
       event.address = event.address.toLocaleLowerCase();
 
-      expect(event).to.be.deep.equal(
-        {
-          address: collectionAddress.toLocaleLowerCase(),
-          event: 'Transfer',
-          args: {
-            from: '0x0000000000000000000000000000000000000000',
-            to: receiver,
-            tokenId,
-          },
+      expect(event).to.be.deep.equal({
+        address: collectionAddress.toLocaleLowerCase(),
+        event: 'Transfer',
+        args: {
+          from: '0x0000000000000000000000000000000000000000',
+          to: receiver,
+          tokenId,
         },
-      );
+      });
 
       expect(await contract.methods.tokenURI(tokenId).call()).to.be.equal('Test URI');
     }
modifiedtests/src/eth/util/playgrounds/unique.dev.tsdiffbeforeafterboth
--- a/tests/src/eth/util/playgrounds/unique.dev.ts
+++ b/tests/src/eth/util/playgrounds/unique.dev.ts
@@ -188,16 +188,16 @@
 
   createCollectionMethodName(mode: TCollectionMode) {
     switch (mode) {
-        case 'ft':
-            return 'createFTCollection';
-        case 'nft':
-            return 'createNFTCollection';
-        case 'rft':
-            return 'createRFTCollection';
+      case 'ft':
+        return 'createFTCollection';
+      case 'nft':
+        return 'createNFTCollection';
+      case 'rft':
+        return 'createRFTCollection';
     }
   }
 
-  async createCollection(mode: TCollectionMode, signer: string, name: string, description: string, tokenPrefix: string, decimals: number = 18): Promise<{ collectionId: number, collectionAddress: string, events: NormalizedEvent[] }> {
+  async createCollection(mode: TCollectionMode, signer: string, name: string, description: string, tokenPrefix: string, decimals = 18): Promise<{ collectionId: number, collectionAddress: string, events: NormalizedEvent[] }> {
     const collectionCreationPrice = this.helper.balance.getCollectionCreationPrice();
     const collectionHelper = this.helper.ethNativeContract.collectionHelpers(signer);
     const functionName: string = this.createCollectionMethodName(mode);
modifiedtests/src/util/playgrounds/unique.tsdiffbeforeafterboth
--- a/tests/src/util/playgrounds/unique.ts
+++ b/tests/src/util/playgrounds/unique.ts
@@ -44,7 +44,7 @@
 } from './types';
 import {RuntimeDispatchInfo} from '@polkadot/types/interfaces';
 import type {Vec} from '@polkadot/types-codec';
-import { FrameSystemEventRecord } from '@polkadot/types/lookup';
+import {FrameSystemEventRecord} from '@polkadot/types/lookup';
 
 export class CrossAccountId implements ICrossAccountId {
   Substrate?: TSubstrateAccount;
@@ -409,17 +409,17 @@
   async subscribeEvents(expectedEvents: {section: string, names: string[]}[]) {
     const collectedEvents: IEvent[] = [];
     const unsubscribe = await this.getApi().query.system.events((events: Vec<FrameSystemEventRecord>) => {
-        const ievents = this.eventHelper.extractEvents(events);
-        ievents.forEach((event) => {
-            expectedEvents.forEach((e => {
-                if (event.section === e.section && e.names.includes(event.method)) {
-                    collectedEvents.push(event);
-                }
-            }))
-        });
+      const ievents = this.eventHelper.extractEvents(events);
+      ievents.forEach((event) => {
+        expectedEvents.forEach((e => {
+          if (event.section === e.section && e.names.includes(event.method)) {
+            collectedEvents.push(event);
+          }
+        }));
+      });
     });
     return {unsubscribe: unsubscribe as any, collectedEvents};
-}
+  }
 
   clearChainLog(): void {
     this.chainLog = [];