Skip to content

Commit

Permalink
fix: fix typos
Browse files Browse the repository at this point in the history
  • Loading branch information
anilhelvaci committed Oct 5, 2024
1 parent f18931a commit 009d0c4
Show file tree
Hide file tree
Showing 2 changed files with 35 additions and 35 deletions.
64 changes: 32 additions & 32 deletions a3p-integration/proposals/z:acceptance/test-lib/sync-tools.js
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
/**
* @file The purpose of this file is to bring together a set of tool that
* @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.
*
* These operations include;
* - Making sure a core-eval resulted succesfully deploying a contract
* - Making sure a core-eval succesfully sent zoe invitations to committee members for governance
* - Making sure a core-eval resulted in successfully deploying a contract
* - Making sure a core-eval successfully sent zoe invitations to committee members for governance
* - Making sure an account is successfully funded with vbank assets like IST, BLD etc.
* - operation: query dest account's balance
* - condition: dest account has a balance >= sent token
Expand All @@ -13,15 +13,15 @@
*/

/**
* @typedef {object} RetyrOptions
* @typedef {object} RetryOptions
* @property {number} maxRetries
* @property {number} retryIntervalMs
* @property {(...arg0: string[]) => void} log
* @property {(object) => void} [setTimeout]
* @property {string} [errorMessage=Error]
*
*
* @typedef {object} CosmosBalanceThresold
* @typedef {object} CosmosBalanceThreshold
* @property {string} denom
* @property {number} value
*/
Expand All @@ -48,7 +48,7 @@ const sleep = (ms, { log = () => {}, setTimeout = ambientSetTimeout }) =>
* @param {() => Promise} operation
* @param {(result: any) => boolean} condition
* @param {string} message
* @param {RetyrOptions} options
* @param {RetryOptions} options
* @returns
*/
const retryUntilCondition = async (
Expand Down Expand Up @@ -86,7 +86,7 @@ const retryUntilCondition = async (
};

/**
* Making sure a core-eval resulted succesfully deploying a contract
* Making sure a core-eval resulted successfully deploying a contract
*/
const makeGetInstances = follow => async () => {
const instanceEntries = await follow(
Expand All @@ -100,16 +100,16 @@ const makeGetInstances = follow => async () => {
/**
*
* @param {string} contractName
* @param {{follow: () => object, setTimeout: (object) => void}} ambientAuthroity
* @param {RetyrOptions} options
* @param {{follow: () => object, setTimeout: (object) => void}} ambientAuthority
* @param {RetryOptions} options
* @returns
*/
export const waitUntilContractDeplyed = (
export const waitUntilContractDeployed = (
contractName,
ambientAuthroity,
ambientAuthority,
options,
) => {
const { follow, setTimeout } = ambientAuthroity;
const { follow, setTimeout } = ambientAuthority;
const getInstances = makeGetInstances(follow);
const {
maxRetries = 6,
Expand All @@ -129,37 +129,37 @@ export const waitUntilContractDeplyed = (

// Making sure an account is successfully funded with vbank assets like IST, BLD etc.

const makeQueryCosmosBalace = queryCb => async dest => {
const conins = await queryCb('bank', 'balances', dest);
return conins.balances;
const makeQueryCosmosBalance = queryCb => async dest => {
const coins = await queryCb('bank', 'balances', dest);
return coins.balances;
};

/**
*
* @param {Array} balances
* @param {CosmosBalanceThresold} thresold
* @param {CosmosBalanceThreshold} threshold
* @returns {boolean}
*/
const checkCosmosBalance = (balances, thresold) => {
const balance = [...balances].find(({ denom }) => denom === thresold.denom);
return Number(balance.amount) >= thresold.value;
const checkCosmosBalance = (balances, threshold) => {
const balance = [...balances].find(({ denom }) => denom === threshold.denom);
return Number(balance.amount) >= threshold.value;
};

/**
* @param {string} destAcct
* @param {{query: () => Promise<object>, setTimeout: (object) => void}} ambientAuthroity
* @param {{query: () => Promise<object>, setTimeout: (object) => void}} ambientAuthority
* @param {{denom: string, value: number}} threshold
* @param {RetyrOptions} options
* @param {RetryOptions} options
* @returns
*/
export const waitUntilAccountFunded = (
destAcct,
ambientAuthroity,
ambientAuthority,
threshold,
options,
) => {
const { query, setTimeout } = ambientAuthroity;
const queryCosmosBalance = makeQueryCosmosBalace(query);
const { query, setTimeout } = ambientAuthority;
const queryCosmosBalance = makeQueryCosmosBalance(query);
const {
maxRetries = 6,
retryIntervalMs = 3500,
Expand Down Expand Up @@ -209,18 +209,18 @@ const checkOfferState = (offerStatus, waitForPayouts, offerId) => {
* @param {string} addr
* @param {string} offerId
* @param {boolean} waitForPayouts
* @param {{follow: () => object, setTimeout: (object) => void}} ambientAuthroity
* @param {RetyrOptions} options
* @param {{follow: () => object, setTimeout: (object) => void}} ambientAuthority
* @param {RetryOptions} options
* @returns
*/
export const waitUntilOfferResult = (
addr,
offerId,
waitForPayouts,
ambientAuthroity,
ambientAuthority,
options,
) => {
const { follow, setTimeout } = ambientAuthroity;
const { follow, setTimeout } = ambientAuthority;
const queryWallet = makeQueryWallet(follow);
const {
maxRetries = 6,
Expand Down Expand Up @@ -257,16 +257,16 @@ const checkForInvitation = update => {
/**
*
* @param {string} addr
* @param {{follow: () => object, setTimeout: (object) => void}} ambientAuthroity
* @param {RetyrOptions} options
* @param {{follow: () => object, setTimeout: (object) => void}} ambientAuthority
* @param {RetryOptions} options
* @returns
*/
export const waitUntilInvitationReceived = (
addr,
ambientAuthroity,
ambientAuthority,
options,
) => {
const { follow, setTimeout } = ambientAuthroity;
const { follow, setTimeout } = ambientAuthority;
const queryWallet = makeQueryWallet(follow);
const {
maxRetries = 6,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import test from 'ava';
import '@endo/init/debug.js';
import {
waitUntilAccountFunded,
waitUntilContractDeplyed,
waitUntilContractDeployed,
waitUntilInvitationReceived,
waitUntilOfferResult,
} from './sync-tools.js';
Expand Down Expand Up @@ -43,7 +43,7 @@ const makeFakeBalanceQuery = () => {

test.serial('wait until contract is deployed', async t => {
const { setValue, follow } = makeFakeFollow();
const waitP = waitUntilContractDeplyed(
const waitP = waitUntilContractDeployed(
'name',
{
follow,
Expand All @@ -53,7 +53,7 @@ test.serial('wait until contract is deployed', async t => {
maxRetries: 5,
retryIntervalMs: 1000,
log: t.log,
errorMessage: 'Contact not deplyed yet',
errorMessage: 'Contract not deployed yet',
},
);

Expand Down

0 comments on commit 009d0c4

Please sign in to comment.