difftreelog
Add requireAwait rule to avoid flakiness in tests
in: master
2 files changed
tests/.eslintrc.jsondiffbeforeafterboth42 "avoidEscape": true42 "avoidEscape": true43 }43 }44 ],44 ],45 "require-await": 2,45 "semi": [46 "semi": [46 "error",47 "error",47 "always"48 "always"tests/src/util/playgrounds/unique.tsdiffbeforeafterboth1627 * @example approveToken(aliceKeyring, 10, 5, {Substrate: "5DyN4Y92vZCjv38fg..."})1627 * @example approveToken(aliceKeyring, 10, 5, {Substrate: "5DyN4Y92vZCjv38fg..."})1628 * @returns ```true``` if extrinsic success, otherwise ```false```1628 * @returns ```true``` if extrinsic success, otherwise ```false```1629 */1629 */1630 async approveToken(signer: IKeyringPair, collectionId: number, tokenId: number, toAddressObj: ICrossAccountId) {1630 approveToken(signer: IKeyringPair, collectionId: number, tokenId: number, toAddressObj: ICrossAccountId) {1631 return super.approveToken(signer, collectionId, tokenId, toAddressObj, 1n);1631 return super.approveToken(signer, collectionId, tokenId, toAddressObj, 1n);1632 }1632 }1633}1633}1820 * @example approveToken(aliceKeyring, 10, 5, {Substrate: "5GHoZe9c73RYbVzq..."}, "", 10000n);1820 * @example approveToken(aliceKeyring, 10, 5, {Substrate: "5GHoZe9c73RYbVzq..."}, "", 10000n);1821 * @returns true if the token success, otherwise false1821 * @returns true if the token success, otherwise false1822 */1822 */1823 async approveToken(signer: IKeyringPair, collectionId: number, tokenId: number, toAddressObj: ICrossAccountId, amount=1n) {1823 approveToken(signer: IKeyringPair, collectionId: number, tokenId: number, toAddressObj: ICrossAccountId, amount=1n) {1824 return super.approveToken(signer, collectionId, tokenId, toAddressObj, amount);1824 return super.approveToken(signer, collectionId, tokenId, toAddressObj, amount);1825 }1825 }182618262032 * @example approveTokens(aliceKeyring, 10, {Substrate: "5GHoZe9c73RYbVzq..."}, 1000n)2032 * @example approveTokens(aliceKeyring, 10, {Substrate: "5GHoZe9c73RYbVzq..."}, 1000n)2033 * @returns ```true``` if extrinsic success, otherwise ```false```2033 * @returns ```true``` if extrinsic success, otherwise ```false```2034 */2034 */2035 async approveTokens(signer: IKeyringPair, collectionId: number, toAddressObj: ICrossAccountId, amount=1n) {2035 approveTokens(signer: IKeyringPair, collectionId: number, toAddressObj: ICrossAccountId, amount=1n) {2036 return super.approveToken(signer, collectionId, 0, toAddressObj, amount);2036 return super.approveToken(signer, collectionId, 0, toAddressObj, amount);2037 }2037 }203820382043 * @param toAddressObj the address approved for the transfer of tokens on behalf of the owner2043 * @param toAddressObj the address approved for the transfer of tokens on behalf of the owner2044 * @returns number of tokens approved for the transfer2044 * @returns number of tokens approved for the transfer2045 */2045 */2046 async getApprovedTokens(collectionId: number, fromAddressObj: ICrossAccountId, toAddressObj: ICrossAccountId) {2046 getApprovedTokens(collectionId: number, fromAddressObj: ICrossAccountId, toAddressObj: ICrossAccountId) {2047 return super.getTokenApprovedPieces(collectionId, 0, toAddressObj, fromAddressObj);2047 return super.getTokenApprovedPieces(collectionId, 0, toAddressObj, fromAddressObj);2048 }2048 }2049}2049}2220 * @example getSubstrate("5GrwvaEF5zXb26Fz...")2220 * @example getSubstrate("5GrwvaEF5zXb26Fz...")2221 * @returns amount of tokens on address2221 * @returns amount of tokens on address2222 */2222 */2223 async getSubstrate(address: TSubstrateAccount): Promise<bigint> {2223 getSubstrate(address: TSubstrateAccount): Promise<bigint> {2224 return this.subBalanceGroup.getSubstrate(address);2224 return this.subBalanceGroup.getSubstrate(address);2225 }2225 }222622262229 * @param address substrate address2229 * @param address substrate address2230 * @returns2230 * @returns2231 */2231 */2232 async getSubstrateFull(address: TSubstrateAccount): Promise<ISubstrateBalance> {2232 getSubstrateFull(address: TSubstrateAccount): Promise<ISubstrateBalance> {2233 return this.subBalanceGroup.getSubstrateFull(address);2233 return this.subBalanceGroup.getSubstrateFull(address);2234 }2234 }223522352239 * @example getEthereum("0x9F0583DbB855d...")2239 * @example getEthereum("0x9F0583DbB855d...")2240 * @returns amount of tokens on address2240 * @returns amount of tokens on address2241 */2241 */2242 async getEthereum(address: TEthereumAccount): Promise<bigint> {2242 getEthereum(address: TEthereumAccount): Promise<bigint> {2243 return this.ethBalanceGroup.getEthereum(address);2243 return this.ethBalanceGroup.getEthereum(address);2244 }2244 }224522452251 * @example transferToSubstrate(aliceKeyring, "5GrwvaEF5zXb26Fz...", 100_000_000_000n);2251 * @example transferToSubstrate(aliceKeyring, "5GrwvaEF5zXb26Fz...", 100_000_000_000n);2252 * @returns ```true``` if extrinsic success, otherwise ```false```2252 * @returns ```true``` if extrinsic success, otherwise ```false```2253 */2253 */2254 async transferToSubstrate(signer: TSigner, address: TSubstrateAccount, amount: bigint | string): Promise<boolean> {2254 transferToSubstrate(signer: TSigner, address: TSubstrateAccount, amount: bigint | string): Promise<boolean> {2255 return this.subBalanceGroup.transferToSubstrate(signer, address, amount);2255 return this.subBalanceGroup.transferToSubstrate(signer, address, amount);2256 }2256 }2257}2257}2402 super(helper);2402 super(helper);2403 }2403 }240424042405 async cancelScheduled(signer: TSigner, scheduledId: string) {2405 cancelScheduled(signer: TSigner, scheduledId: string) {2406 return this.helper.executeExtrinsic(2406 return this.helper.executeExtrinsic(2407 signer,2407 signer,2408 'api.tx.scheduler.cancelNamed',2408 'api.tx.scheduler.cancelNamed',2411 );2411 );2412 }2412 }241324132414 async changePriority(signer: TSigner, scheduledId: string, priority: number) {2414 changePriority(signer: TSigner, scheduledId: string, priority: number) {2415 return this.helper.executeExtrinsic(2415 return this.helper.executeExtrinsic(2416 signer,2416 signer,2417 'api.tx.scheduler.changeNamedPriority',2417 'api.tx.scheduler.changeNamedPriority',