Skip to content

Commit

Permalink
fix(sync-tools): apply new linting rules and fix rebase conflicts
Browse files Browse the repository at this point in the history
Refs: #10238
  • Loading branch information
anilhelvaci committed Oct 16, 2024
1 parent 76d4889 commit fd37b7c
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 23 deletions.
1 change: 0 additions & 1 deletion a3p-integration/proposals/z:acceptance/test-lib/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
19 changes: 10 additions & 9 deletions a3p-integration/proposals/z:acceptance/test-lib/sync-tools.js
Original file line number Diff line number Diff line change
@@ -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.
Expand Down Expand Up @@ -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
Expand All @@ -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);
});
Expand All @@ -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,
Expand All @@ -73,7 +74,7 @@ const retryUntilCondition = async (
}
}

retries++;
retries += 1;
console.log(
`Retry ${retries}/${maxRetries} - Waiting for ${retryIntervalMs}ms for ${message}...`,
);
Expand All @@ -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(
Expand Down Expand Up @@ -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);
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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 /////////////

/**
*
Expand Down
27 changes: 14 additions & 13 deletions a3p-integration/proposals/z:acceptance/test-lib/sync-tools.test.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
/* eslint-env node */
// @ts-check
import test from 'ava';
import '@endo/init/debug.js';
Expand Down Expand Up @@ -47,7 +48,7 @@ test.serial('wait until contract is deployed', async t => {
'name',
{
follow,
setTimeout: globalThis.setTimeout,
setTimeout,
},
{
maxRetries: 5,
Expand All @@ -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,
Expand Down Expand Up @@ -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,
Expand Down Expand Up @@ -150,7 +151,7 @@ test.serial(
'agoric12345',
'my-offer',
false,
{ follow, setTimeout: globalThis.setTimeout },
{ follow, setTimeout },
{
maxRetries: 5,
retryIntervalMs: 1000,
Expand All @@ -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,
Expand All @@ -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,
Expand All @@ -216,7 +217,7 @@ test.serial(
'agoric12345',
'my-offer',
false,
{ follow, setTimeout: globalThis.setTimeout },
{ follow, setTimeout },
{
maxRetries: 5,
retryIntervalMs: 1000,
Expand All @@ -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,
Expand Down Expand Up @@ -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,
Expand Down Expand Up @@ -324,7 +325,7 @@ test.serial(

const waitP = waitUntilInvitationReceived(
'agoric12345',
{ follow, setTimeout: globalThis.setTimeout },
{ follow, setTimeout },
{
maxRetries: 3,
retryIntervalMs: 1000,
Expand All @@ -345,7 +346,7 @@ test.serial(

const waitP = waitUntilInvitationReceived(
'agoric12345',
{ follow, setTimeout: globalThis.setTimeout },
{ follow, setTimeout },
{
maxRetries: 5,
retryIntervalMs: 1000,
Expand All @@ -371,7 +372,7 @@ test.serial(

const waitP = waitUntilInvitationReceived(
'agoric12345',
{ follow, setTimeout: globalThis.setTimeout },
{ follow, setTimeout },
{
maxRetries: 3,
retryIntervalMs: 1000,
Expand All @@ -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,
Expand Down

0 comments on commit fd37b7c

Please sign in to comment.