Skip to content

Commit

Permalink
fix: improve type definitions and comment readability
Browse files Browse the repository at this point in the history
  • Loading branch information
anilhelvaci committed Oct 5, 2024
1 parent 009d0c4 commit d3f2453
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 16 deletions.
19 changes: 5 additions & 14 deletions a3p-integration/proposals/z:acceptance/test-lib/sync-tools.js
Original file line number Diff line number Diff line change
Expand Up @@ -85,9 +85,8 @@ const retryUntilCondition = async (
throw Error(`${message} condition failed after ${maxRetries} retries.`);
};

/**
* 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(
'-lF',
Expand Down Expand Up @@ -122,12 +121,11 @@ export const waitUntilContractDeployed = (
getInstances,
instanceObject => Object.keys(instanceObject).includes(contractName),
errorMessage,
// @ts-ignore
{ maxRetries, retryIntervalMs, log, setTimeout },
);
};

// 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 All @@ -150,7 +148,6 @@ const checkCosmosBalance = (balances, threshold) => {
* @param {{query: () => Promise<object>, setTimeout: (object) => void}} ambientAuthority
* @param {{denom: string, value: number}} threshold
* @param {RetryOptions} options
* @returns
*/
export const waitUntilAccountFunded = (
destAcct,
Expand All @@ -171,12 +168,11 @@ export const waitUntilAccountFunded = (
async () => queryCosmosBalance(destAcct),
balances => checkCosmosBalance(balances, threshold),
errorMessage,
// @ts-ignore
{ maxRetries, retryIntervalMs, log, setTimeout },
);
};

// Making sure an offer is resulted
///////////// Making sure an offers get results /////////////

const makeQueryWallet = follow => async (/** @type {String} */ addr) => {
const update = await follow('-lF', `:published.wallet.${addr}`);
Expand All @@ -189,7 +185,6 @@ const makeQueryWallet = follow => async (/** @type {String} */ addr) => {
* @param {object} offerStatus
* @param {boolean} waitForPayouts
* @param {string} offerId
* @returns
*/
const checkOfferState = (offerStatus, waitForPayouts, offerId) => {
const { updated, status } = offerStatus;
Expand All @@ -211,7 +206,6 @@ const checkOfferState = (offerStatus, waitForPayouts, offerId) => {
* @param {boolean} waitForPayouts
* @param {{follow: () => object, setTimeout: (object) => void}} ambientAuthority
* @param {RetryOptions} options
* @returns
*/
export const waitUntilOfferResult = (
addr,
Expand All @@ -233,12 +227,11 @@ export const waitUntilOfferResult = (
async () => queryWallet(addr),
status => checkOfferState(status, waitForPayouts, offerId),
errorMessage,
// @ts-ignore
{ maxRetries, retryIntervalMs, log, setTimeout },
);
};

// Making sure a core-eval succesfully sent zoe invitations to committee members for governance
///////////// Making sure a core-eval successfully sent zoe invitations to committee members for governance /////////////

/**
*
Expand All @@ -259,7 +252,6 @@ const checkForInvitation = update => {
* @param {string} addr
* @param {{follow: () => object, setTimeout: (object) => void}} ambientAuthority
* @param {RetryOptions} options
* @returns
*/
export const waitUntilInvitationReceived = (
addr,
Expand All @@ -279,7 +271,6 @@ export const waitUntilInvitationReceived = (
async () => queryWallet(addr),
checkForInvitation,
errorMessage,
// @ts-ignore
{ maxRetries, retryIntervalMs, log, setTimeout },
);
};
Original file line number Diff line number Diff line change
Expand Up @@ -261,7 +261,7 @@ test.serial('wait until offer result, do not wait for "payouts"', async t => {
updated: 'offerStatus',
}),
3000,
); // First, offer is resulted
); // Then offer got results

await t.notThrowsAsync(waitP);
});
Expand Down Expand Up @@ -298,7 +298,7 @@ test.serial('wait until offer result, wait for "payouts"', async t => {
updated: 'offerStatus',
}),
3000,
); // Now, offer is resulted
); // Now offer got results
setTimeout(
() =>
setValue({
Expand Down

0 comments on commit d3f2453

Please sign in to comment.