git.delta.rocks / unique-network / refs/commits / 408e6a1db82d

difftreelog

Add requireAwait rule to avoid flakiness in tests

Max Andreev2022-10-25parent: #bb1e6df.patch.diff
in: master

2 files changed

modifiedtests/.eslintrc.jsondiffbeforeafterboth
before · tests/.eslintrc.json
1{2    "env": {3        "browser": true,4        "es2020": true5    },6    "extends": [7        "eslint:recommended",8        "plugin:@typescript-eslint/recommended"9    ],10    "parser": "@typescript-eslint/parser",11    "parserOptions": {12        "ecmaVersion": 11,13        "sourceType": "module"14    },15    "plugins": [16        "@typescript-eslint"17    ],18    "rules": {19        "indent": [20            "error",21            2,22            {23                "SwitchCase": 124            }25        ],26        "function-call-argument-newline": [27            "error",28            "consistent"29        ],30        "function-paren-newline": [31            "error",32            "multiline"33        ],34        "linebreak-style": [35            "error",36            "unix"37        ],38        "quotes": [39            "error",40            "single",41            {42                "avoidEscape": true43            }44        ],45        "semi": [46            "error",47            "always"48        ],49        "@typescript-eslint/explicit-module-boundary-types": "off",50        "comma-dangle": [51            "error",52            "always-multiline"53        ],54        "no-unused-vars": "off",55        "@typescript-eslint/no-empty-function": "off",56        "@typescript-eslint/no-non-null-assertion": "off",57        "@typescript-eslint/no-explicit-any": "off",58        "@typescript-eslint/no-unused-vars": [59            "warn",60            {61                "varsIgnorePattern": "_.+",62                "argsIgnorePattern": "_.+"63            }64        ],65        "no-async-promise-executor": "warn",66        "@typescript-eslint/no-empty-interface": "off",67        "prefer-const": [68            "error",69            {70                "destructuring": "all"71            }72        ],73        "@typescript-eslint/ban-ts-comment": "off",74        "object-curly-spacing": "warn",75        "arrow-spacing": "warn",76        "array-bracket-spacing": "warn",77        "template-curly-spacing": "warn",78        "space-in-parens": "warn",79        "@typescript-eslint/naming-convention": [80            "warn",81            {82                "selector": "default",83                "format": [84                    "camelCase"85                ],86                "leadingUnderscore": "allow",87                "trailingUnderscore": "allow"88            },89            {90                "selector": "variable",91                "format": [92                    "camelCase",93                    "UPPER_CASE"94                ],95                "leadingUnderscore": "allow",96                "trailingUnderscore": "allow"97            },98            {99                "selector": "typeLike",100                "format": [101                    "PascalCase"102                ]103            },104            {105                "selector": "memberLike",106                "format": null107            }108        ]109    }110}
modifiedtests/src/util/playgrounds/unique.tsdiffbeforeafterboth
--- a/tests/src/util/playgrounds/unique.ts
+++ b/tests/src/util/playgrounds/unique.ts
@@ -1627,7 +1627,7 @@
    * @example approveToken(aliceKeyring, 10, 5, {Substrate: "5DyN4Y92vZCjv38fg..."})
    * @returns ```true``` if extrinsic success, otherwise ```false```
    */
-  async approveToken(signer: IKeyringPair, collectionId: number, tokenId: number, toAddressObj: ICrossAccountId) {
+  approveToken(signer: IKeyringPair, collectionId: number, tokenId: number, toAddressObj: ICrossAccountId) {
     return super.approveToken(signer, collectionId, tokenId, toAddressObj, 1n);
   }
 }
@@ -1820,7 +1820,7 @@
    * @example approveToken(aliceKeyring, 10, 5, {Substrate: "5GHoZe9c73RYbVzq..."}, "", 10000n);
    * @returns true if the token success, otherwise false
    */
-  async approveToken(signer: IKeyringPair, collectionId: number, tokenId: number, toAddressObj: ICrossAccountId, amount=1n) {
+  approveToken(signer: IKeyringPair, collectionId: number, tokenId: number, toAddressObj: ICrossAccountId, amount=1n) {
     return super.approveToken(signer, collectionId, tokenId, toAddressObj, amount);
   }
 
@@ -2032,7 +2032,7 @@
    * @example approveTokens(aliceKeyring, 10, {Substrate: "5GHoZe9c73RYbVzq..."}, 1000n)
    * @returns ```true``` if extrinsic success, otherwise ```false```
    */
-  async approveTokens(signer: IKeyringPair, collectionId: number, toAddressObj: ICrossAccountId, amount=1n) {
+  approveTokens(signer: IKeyringPair, collectionId: number, toAddressObj: ICrossAccountId, amount=1n) {
     return super.approveToken(signer, collectionId, 0, toAddressObj, amount);
   }
 
@@ -2043,7 +2043,7 @@
    * @param toAddressObj the address approved for the transfer of tokens on behalf of the owner
    * @returns number of tokens approved for the transfer
    */
-  async getApprovedTokens(collectionId: number, fromAddressObj: ICrossAccountId, toAddressObj: ICrossAccountId) {
+  getApprovedTokens(collectionId: number, fromAddressObj: ICrossAccountId, toAddressObj: ICrossAccountId) {
     return super.getTokenApprovedPieces(collectionId, 0, toAddressObj, fromAddressObj);
   }
 }
@@ -2220,7 +2220,7 @@
    * @example getSubstrate("5GrwvaEF5zXb26Fz...")
    * @returns amount of tokens on address
    */
-  async getSubstrate(address: TSubstrateAccount): Promise<bigint> {
+  getSubstrate(address: TSubstrateAccount): Promise<bigint> {
     return this.subBalanceGroup.getSubstrate(address);
   }
 
@@ -2229,7 +2229,7 @@
    * @param address substrate address
    * @returns
    */
-  async getSubstrateFull(address: TSubstrateAccount): Promise<ISubstrateBalance> {
+  getSubstrateFull(address: TSubstrateAccount): Promise<ISubstrateBalance> {
     return this.subBalanceGroup.getSubstrateFull(address);
   }
 
@@ -2239,7 +2239,7 @@
    * @example getEthereum("0x9F0583DbB855d...")
    * @returns amount of tokens on address
    */
-  async getEthereum(address: TEthereumAccount): Promise<bigint> {
+  getEthereum(address: TEthereumAccount): Promise<bigint> {
     return this.ethBalanceGroup.getEthereum(address);
   }
 
@@ -2251,7 +2251,7 @@
    * @example transferToSubstrate(aliceKeyring, "5GrwvaEF5zXb26Fz...", 100_000_000_000n);
    * @returns ```true``` if extrinsic success, otherwise ```false```
    */
-  async transferToSubstrate(signer: TSigner, address: TSubstrateAccount, amount: bigint | string): Promise<boolean> {
+  transferToSubstrate(signer: TSigner, address: TSubstrateAccount, amount: bigint | string): Promise<boolean> {
     return this.subBalanceGroup.transferToSubstrate(signer, address, amount);
   }
 }
@@ -2402,7 +2402,7 @@
     super(helper);
   }
 
-  async cancelScheduled(signer: TSigner, scheduledId: string) {
+  cancelScheduled(signer: TSigner, scheduledId: string) {
     return this.helper.executeExtrinsic(
       signer,
       'api.tx.scheduler.cancelNamed',
@@ -2411,7 +2411,7 @@
     );
   }
 
-  async changePriority(signer: TSigner, scheduledId: string, priority: number) {
+  changePriority(signer: TSigner, scheduledId: string, priority: number) {
     return this.helper.executeExtrinsic(
       signer,
       'api.tx.scheduler.changeNamedPriority',