Skip to content

Commit

Permalink
fix(acceptance-auction): lint fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
anilhelvaci committed Oct 29, 2024
1 parent 6fc0e4d commit c32bcb5
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 16 deletions.
7 changes: 4 additions & 3 deletions a3p-integration/proposals/z:acceptance/auction.test.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
/* eslint-env node */
/**
* @file In this file we aim to test auctioneer in an isolated manner. Here's the scenario to test;
*
Expand All @@ -17,7 +18,7 @@
*/

// Typo will be fixed with https://github.com/Agoric/agoric-sdk/pull/10171
/** @typedef {import('./test-lib/sync-tools.js').RetyrOptions} RetryOptions */
/** @typedef {import('./test-lib/sync-tools.js').RetryOptions} RetryOptions */

import {
agd,
Expand Down Expand Up @@ -47,7 +48,7 @@ import {
const ambientAuthority = {
query: agd.query,
follow: agoric.follow,
setTimeout: globalThis.setTimeout,
setTimeout,
};

const fromBoard = makeFromBoard();
Expand Down Expand Up @@ -129,7 +130,7 @@ test.before(async t => {
':published.priceFeed.ATOM-USD_price_feed.latestRound',
);
t.context = {
roundId: parseInt(round.roundId),
roundId: parseInt(round.roundId, 10),
retryOpts: {
bankSendRetryOpts,
pushPriceRetryOpts,
Expand Down
23 changes: 12 additions & 11 deletions a3p-integration/proposals/z:acceptance/test-lib/auction-lib.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
/* eslint-env node */
import {
addPreexistingOracles,
agd,
Expand All @@ -11,23 +12,23 @@ import {
pushPrices,
VALIDATORADDR,
} from '@agoric/synthetic-chain';
import { AmountMath } from '@agoric/ertp';
import {
retryUntilCondition,
waitUntilAccountFunded,
waitUntilOfferResult,
} from './sync-tools.js';
import { boardSlottingMarshaller, makeFromBoard } from './rpc.js';
import { AmountMath } from '@agoric/ertp';

/**
* Typo will be fixed with https://github.com/Agoric/agoric-sdk/pull/10171
* @typedef {import('./sync-tools.js').RetyrOptions} RetryOptions
* @typedef {import('./sync-tools.js').RetryOptions} RetryOptions
*/

const ambientAuthority = {
query: agd.query,
follow: agoric.follow,
setTimeout: globalThis.setTimeout,
setTimeout,
};

export const scale6 = x => BigInt(x * 1_000_000);
Expand Down Expand Up @@ -57,7 +58,7 @@ export const pushPricesForAuction = async (t, price) => {
'price not pushed yet',
{
log: t.log,
setTimeout: globalThis.setTimeout,
setTimeout,
...t.context.pushPriceRetryOpts,
},
);
Expand All @@ -70,7 +71,7 @@ export const pushPricesForAuction = async (t, price) => {
* offerId: string,
* depositValue: string,
* }} depositor
* @param {Object<string, {
* @param {Record<string, {
* bidder: string,
* bidderFund: {
* value: number,
Expand Down Expand Up @@ -107,7 +108,7 @@ export const fundAccts = async (t, depositor, bidders) => {
}
};

export const bidByPrice = (price, give, offerId, bidder, t) => {
export const bidByPrice = (price, give, offerId, bidder) => {
return agopsInter(
'bid',
'by-price',
Expand All @@ -120,7 +121,7 @@ export const bidByPrice = (price, give, offerId, bidder, t) => {
);
};

export const bidByDiscount = (discount, give, offerId, bidder, t) => {
export const bidByDiscount = (discount, give, offerId, bidder) => {
return agopsInter(
'bid',
'by-discount',
Expand All @@ -136,8 +137,8 @@ export const bidByDiscount = (discount, give, offerId, bidder, t) => {
export const placeBids = (t, bidsSetup) => {
return [...Object.values(bidsSetup)].map(
({ bidder, offerId, price, give, discount }) => {
if (price) return bidByPrice(price, give, offerId, bidder, t);
return bidByDiscount(discount, give, offerId, bidder, t);
if (price) return bidByPrice(price, give, offerId, bidder);
return bidByDiscount(discount, give, offerId, bidder);
},
);
};
Expand All @@ -147,7 +148,7 @@ export const placeBids = (t, bidsSetup) => {
*/
export const calculateRetryUntilNextStartTime = async () => {
const schedule = await agoric.follow('-lF', ':published.auction.schedule');
const nextStartTime = parseInt(schedule.nextStartTime.absValue);
const nextStartTime = parseInt(schedule.nextStartTime.absValue, 10);

/** @type {RetryOptions} */
const capturePriceRetryOpts = {
Expand Down Expand Up @@ -251,7 +252,7 @@ export const checkDepositOutcome = (t, depositorPayouts, config, brands) => {
} = config;

const getNumberFromGive = give =>
parseInt(give.substring(0, give.length - 3));
parseInt(give.substring(0, give.length - 3), 10);

const calculateGiveTotal = () => {
let currentBidSum = getNumberFromGive(longLivingBidGive);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@ import '@endo/init';
import { AmountMath } from '@agoric/ertp';
import { Far } from '@endo/far';
import test from 'ava';
import { checkBidsOutcome, checkDepositOutcome } from './auction-lib.js';
import { GOV3ADDR, USER1ADDR } from '@agoric/synthetic-chain';
import { checkBidsOutcome, checkDepositOutcome } from './auction-lib.js';

// From auction.test.js
const config = {
Expand Down Expand Up @@ -73,7 +73,7 @@ test.before(t => {
};
});

test('make sure check* functions work properly', async t => {
test('make sure check* functions work properly', t => {
// @ts-expect-error
const { brands } = t.context;
const result = {
Expand Down

0 comments on commit c32bcb5

Please sign in to comment.