From fd37b7c1ee5acad9f209502b10b281f6c869a218 Mon Sep 17 00:00:00 2001 From: anilhelvaci Date: Wed, 16 Oct 2024 21:37:46 +0300 Subject: [PATCH] fix(sync-tools): apply new linting rules and fix rebase conflicts Refs: https://github.com/Agoric/agoric-sdk/issues/10238 --- .../proposals/z:acceptance/test-lib/index.js | 1 - .../z:acceptance/test-lib/sync-tools.js | 19 ++++++------- .../z:acceptance/test-lib/sync-tools.test.js | 27 ++++++++++--------- 3 files changed, 24 insertions(+), 23 deletions(-) diff --git a/a3p-integration/proposals/z:acceptance/test-lib/index.js b/a3p-integration/proposals/z:acceptance/test-lib/index.js index 0c6fffa980a6..2f2e7c02d3c1 100644 --- a/a3p-integration/proposals/z:acceptance/test-lib/index.js +++ b/a3p-integration/proposals/z:acceptance/test-lib/index.js @@ -15,7 +15,6 @@ export const networkConfig = { */ const delay = ms => new Promise(resolve => setTimeout(() => resolve(), ms)); -// eslint-disable-next-line @jessie.js/safe-await-separator -- buggy version export const walletUtils = await makeWalletUtils( { delay, execFileSync, fetch }, networkConfig, diff --git a/a3p-integration/proposals/z:acceptance/test-lib/sync-tools.js b/a3p-integration/proposals/z:acceptance/test-lib/sync-tools.js index 2d59deccba5f..f0daeddabde0 100644 --- a/a3p-integration/proposals/z:acceptance/test-lib/sync-tools.js +++ b/a3p-integration/proposals/z:acceptance/test-lib/sync-tools.js @@ -1,3 +1,5 @@ +/* eslint-env node */ + /** * @file The purpose of this file is to bring together a set of tools that * developers can use to synchronize operations they carry out in their tests. @@ -26,7 +28,7 @@ * @property {number} value */ -const ambientSetTimeout = globalThis.setTimeout; +const ambientSetTimeout = global.setTimeout; /** * From https://github.com/Agoric/agoric-sdk/blob/442f07c8f0af03281b52b90e90c27131eef6f331/multichain-testing/tools/sleep.ts#L10 @@ -36,7 +38,6 @@ const ambientSetTimeout = globalThis.setTimeout; */ const sleep = (ms, { log = () => {}, setTimeout = ambientSetTimeout }) => new Promise(resolve => { - // @ts-ignore log(`Sleeping for ${ms}ms...`); setTimeout(resolve, ms); }); @@ -49,7 +50,7 @@ const sleep = (ms, { log = () => {}, setTimeout = ambientSetTimeout }) => * @param {string} message * @param {RetryOptions} options */ -const retryUntilCondition = async ( +export const retryUntilCondition = async ( operation, condition, message, @@ -73,7 +74,7 @@ const retryUntilCondition = async ( } } - retries++; + retries += 1; console.log( `Retry ${retries}/${maxRetries} - Waiting for ${retryIntervalMs}ms for ${message}...`, ); @@ -97,7 +98,7 @@ const overrideDefaultOptions = options => { return { ...defaultValues, ...options }; }; -///////////// Making sure a core-eval resulted successfully deploying a contract ///////////// +/// ////////// Making sure a core-eval resulted successfully deploying a contract ///////////// const makeGetInstances = follow => async () => { const instanceEntries = await follow( @@ -132,7 +133,7 @@ export const waitUntilContractDeployed = ( ); }; -///////////// Making sure an account is successfully funded with vbank assets like IST, BLD etc. /////////////// +/// ////////// Making sure an account is successfully funded with vbank assets like IST, BLD etc. /////////////// const makeQueryCosmosBalance = queryCb => async dest => { const coins = await queryCb('bank', 'balances', dest); @@ -175,9 +176,9 @@ export const waitUntilAccountFunded = ( ); }; -///////////// Making sure an offers get results ///////////// +/// ////////// Making sure an offers get results ///////////// -const makeQueryWallet = follow => async (/** @type {String} */ addr) => { +const makeQueryWallet = follow => async (/** @type {string} */ addr) => { const update = await follow('-lF', `:published.wallet.${addr}`); return update; @@ -230,7 +231,7 @@ export const waitUntilOfferResult = ( ); }; -///////////// Making sure a core-eval successfully sent zoe invitations to committee members for governance ///////////// +/// ////////// Making sure a core-eval successfully sent zoe invitations to committee members for governance ///////////// /** * diff --git a/a3p-integration/proposals/z:acceptance/test-lib/sync-tools.test.js b/a3p-integration/proposals/z:acceptance/test-lib/sync-tools.test.js index c79b090a4134..2b0d3603c4b5 100644 --- a/a3p-integration/proposals/z:acceptance/test-lib/sync-tools.test.js +++ b/a3p-integration/proposals/z:acceptance/test-lib/sync-tools.test.js @@ -1,3 +1,4 @@ +/* eslint-env node */ // @ts-check import test from 'ava'; import '@endo/init/debug.js'; @@ -47,7 +48,7 @@ test.serial('wait until contract is deployed', async t => { 'name', { follow, - setTimeout: globalThis.setTimeout, + setTimeout, }, { maxRetries: 5, @@ -67,7 +68,7 @@ test.serial('wait until account funded', async t => { const waitP = waitUntilAccountFunded( 'agoric12345', - { query, setTimeout: globalThis.setTimeout }, + { query, setTimeout }, { denom: 'ufake', value: 100_000 }, { maxRetries: 5, @@ -106,7 +107,7 @@ test.serial('wait until account funded, insufficient balance', async t => { const waitP = waitUntilAccountFunded( 'agoric12345', - { query, setTimeout: globalThis.setTimeout }, + { query, setTimeout }, { denom: 'ufake', value: 100_000 }, { maxRetries: 5, @@ -150,7 +151,7 @@ test.serial( 'agoric12345', 'my-offer', false, - { follow, setTimeout: globalThis.setTimeout }, + { follow, setTimeout }, { maxRetries: 5, retryIntervalMs: 1000, @@ -171,7 +172,7 @@ test.serial('wait until offer result, wrong id - should throw', async t => { 'agoric12345', 'my-offer', false, - { follow, setTimeout: globalThis.setTimeout }, + { follow, setTimeout }, { maxRetries: 5, retryIntervalMs: 1000, @@ -191,7 +192,7 @@ test.serial('wait until offer result, no "status" - should throw', async t => { 'agoric12345', 'my-offer', false, - { follow, setTimeout: globalThis.setTimeout }, + { follow, setTimeout }, { maxRetries: 5, retryIntervalMs: 1000, @@ -216,7 +217,7 @@ test.serial( 'agoric12345', 'my-offer', false, - { follow, setTimeout: globalThis.setTimeout }, + { follow, setTimeout }, { maxRetries: 5, retryIntervalMs: 1000, @@ -237,7 +238,7 @@ test.serial('wait until offer result, do not wait for "payouts"', async t => { 'agoric12345', 'my-offer', false, - { follow, setTimeout: globalThis.setTimeout }, + { follow, setTimeout }, { maxRetries: 7, retryIntervalMs: 1000, @@ -274,7 +275,7 @@ test.serial('wait until offer result, wait for "payouts"', async t => { 'agoric12345', 'my-offer', true, - { follow, setTimeout: globalThis.setTimeout }, + { follow, setTimeout }, { maxRetries: 7, retryIntervalMs: 1000, @@ -324,7 +325,7 @@ test.serial( const waitP = waitUntilInvitationReceived( 'agoric12345', - { follow, setTimeout: globalThis.setTimeout }, + { follow, setTimeout }, { maxRetries: 3, retryIntervalMs: 1000, @@ -345,7 +346,7 @@ test.serial( const waitP = waitUntilInvitationReceived( 'agoric12345', - { follow, setTimeout: globalThis.setTimeout }, + { follow, setTimeout }, { maxRetries: 5, retryIntervalMs: 1000, @@ -371,7 +372,7 @@ test.serial( const waitP = waitUntilInvitationReceived( 'agoric12345', - { follow, setTimeout: globalThis.setTimeout }, + { follow, setTimeout }, { maxRetries: 3, retryIntervalMs: 1000, @@ -390,7 +391,7 @@ test.serial('wait until invitation recevied', async t => { const waitP = waitUntilInvitationReceived( 'agoric12345', - { follow, setTimeout: globalThis.setTimeout }, + { follow, setTimeout }, { maxRetries: 5, retryIntervalMs: 1000,