Skip to content

Commit

Permalink
update types for Ava 4
Browse files Browse the repository at this point in the history
  • Loading branch information
turadg committed Jul 25, 2022
1 parent 393909d commit 63a5077
Show file tree
Hide file tree
Showing 15 changed files with 18 additions and 33 deletions.
1 change: 1 addition & 0 deletions packages/agoric-cli/test/test-publish-bundle.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ test('fake publish bundle ok', async t => {
t.is(hostname, 'localhost');
t.is(port, 8080);
t.is(path, '/publish-bundle?accessToken=TO%20KEN');
// @ts-expect-error unknown
t.is(bundle, receivedBundle);
return { ok: true };
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,7 @@ import { subscriptionTracker } from '../../metrics.js';
/** @typedef {Record<string, any> & {
* bundleCache: Awaited<ReturnType<typeof unsafeMakeBundleCache>>,
* }} Context */
/** @type {import('ava').TestInterface<Context>} */
// @ts-expect-error cast
/** @type {import('ava').TestFn<Context>} */
const test = unknownTest;

test.before(async t => {
Expand Down
3 changes: 1 addition & 2 deletions packages/inter-protocol/test/psm/test-psm.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,7 @@ import {
subscriptionKey,
} from '../supports.js';

/** @type {import('ava').TestInterface<Awaited<ReturnType<makeTestContext>>>} */
// @ts-expect-error cast
/** @type {import('ava').TestFn<Awaited<ReturnType<makeTestContext>>>} */
const test = anyTest;

const pathname = new URL(import.meta.url).pathname;
Expand Down
3 changes: 1 addition & 2 deletions packages/inter-protocol/test/runStake/test-runStake.js
Original file line number Diff line number Diff line change
Expand Up @@ -73,8 +73,7 @@ const micro = harden({
* },
* }} RunStakeTestContext
*/
/** @type {import('ava').TestInterface<RunStakeTestContext>} */
// @ts-expect-error cast
/** @type {import('ava').TestFn<RunStakeTestContext>} */
const test = unknownTest;

test.before(async t => {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
// @ts-check

// eslint-disable-next-line import/no-extraneous-dependencies
import '@endo/init/debug.js';
// eslint-disable-next-line import/no-extraneous-dependencies
import rawTest from 'ava';
import anyTest from 'ava';
import { buildVatController, buildKernelBundles } from '@agoric/swingset-vat';
import bundleSource from '@endo/bundle-source';
import { E } from '@endo/eventual-send';
Expand All @@ -17,9 +15,8 @@ import { unsafeMakeBundleCache } from '../../bundleTool.js';

const dirname = new URL('.', import.meta.url).pathname;

/** @type {import('ava').TestInterface<{ data: { kernelBundles: any, config: any } }>} */
// @ts-expect-error cast
const test = rawTest;
/** @type {import('ava').TestFn<{ data: { kernelBundles: any, config: any } }>} */
const test = anyTest;

test.before(async t => {
const kernelBundles = await buildKernelBundles();
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
// @ts-check

// eslint-disable-next-line import/no-extraneous-dependencies
import '@endo/init/debug.js';
// eslint-disable-next-line import/no-extraneous-dependencies
import rawTest from 'ava';
import anyTest from 'ava';
import path from 'path';
import { buildVatController, buildKernelBundles } from '@agoric/swingset-vat';
import bundleSource from '@endo/bundle-source';
Expand All @@ -17,9 +15,8 @@ import liquidateMinimumBundle from '../../../bundles/bundle-liquidateMinimum.js'
import ammBundle from '../../../bundles/bundle-amm.js';
import vaultFactoryBundle from '../../../bundles/bundle-vaultFactory.js';

/** @type {import('ava').TestInterface<{ data: { kernelBundles: any, config: any } }>} */
// @ts-expect-error cast
const test = rawTest;
/** @type {import('ava').TestFn<{ data: { kernelBundles: any, config: any } }>} */
const test = anyTest;

/**
*
Expand Down
3 changes: 1 addition & 2 deletions packages/inter-protocol/test/test-gov-collateral.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,7 @@ import { setupBootstrap, setUpZoeForTest, mintRunPayment } from './supports.js';
const { details: X } = assert;
const dirname = url.fileURLToPath(new URL('.', import.meta.url));

/** @type {import('ava').TestInterface<Awaited<ReturnType<typeof makeTestContext>>>} */
// @ts-expect-error cast
/** @type {import('ava').TestFn<Awaited<ReturnType<typeof makeTestContext>>>} */
const test = anyTest;

const contractRoots = {
Expand Down
3 changes: 1 addition & 2 deletions packages/inter-protocol/test/test-interchainPool.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,7 @@ import { startInterchainPool } from '../src/proposals/econ-behaviors.js';

/** @template T @typedef {import('@endo/promise-kit').PromiseKit<T>} PromiseKit */

/** @type {import('ava').TestInterface<Awaited<ReturnType<makeTestContext>>>} */
// @ts-expect-error cast
/** @type {import('ava').TestFn<Awaited<ReturnType<makeTestContext>>>} */
const test = anyTest;

const contractRoots = {
Expand Down
3 changes: 1 addition & 2 deletions packages/inter-protocol/test/vaultFactory/test-liquidator.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,7 @@ import {

/** @typedef {import('./driver.js').DriverContext & {
* }} Context */
/** @type {import('ava').TestInterface<Context>} */
// @ts-expect-error cast
/** @type {import('ava').TestFn<Context>} */
const test = unknownTest;

const trace = makeTracer('TestLiq');
Expand Down
3 changes: 1 addition & 2 deletions packages/inter-protocol/test/vaultFactory/test-storage.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,7 @@ import { makeDriverContext, makeManagerDriver } from './driver.js';

/** @typedef {import('./driver.js').DriverContext & {
* }} Context */
/** @type {import('ava').TestInterface<Context>} */
// @ts-expect-error cast
/** @type {import('ava').TestFn<Context>} */
const test = unknownTest;

const trace = makeTracer('TestLiq');
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ for (const [debt, collat, vaultId, expectedKey, numberOut] of [
AmountMath.make(mockBrand, BigInt(collat)),
String(vaultId),
);
// @ts-expect-error TODO use macros
t.is(key, expectedKey);
t.deepEqual(StoreUtils.fromVaultKey(key), [numberOut, vaultId]);
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,8 +62,7 @@ import {
* loanTiming: LoanTiming,
* zoe: ZoeService,
* }} Context */
/** @type {import('ava').TestInterface<Context>} */
// @ts-expect-error cast
/** @type {import('ava').TestFn<Context>} */
const test = unknownTest;

// #region Support
Expand Down
3 changes: 1 addition & 2 deletions packages/wallet/contract/test/test-singleWallet.js
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,7 @@ import { E, Far } from '@endo/far';
import path from 'path';
import { devices } from './devices.js';

/** @type {import('ava').TestInterface<Awaited<ReturnType<makeTestContext>>>} */
// @ts-expect-error cast
/** @type {import('ava').TestFn<Awaited<ReturnType<makeTestContext>>>} */
const test = anyTest;

const setUpZoeForTest = async () => {
Expand Down
3 changes: 1 addition & 2 deletions packages/wallet/contract/test/test-walletFactory.js
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,7 @@ import { E, Far } from '@endo/far';
import path from 'path';
import { devices } from './devices.js';

/** @type {import('ava').TestInterface<Awaited<ReturnType<makeTestContext>>>} */
// @ts-expect-error cast
/** @type {import('ava').TestFn<Awaited<ReturnType<makeTestContext>>>} */
const test = anyTest;

const setUpZoeForTest = async () => {
Expand Down
1 change: 0 additions & 1 deletion packages/zoe/test/unitTests/zoe/test-createZCFVat.js
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,6 @@ test('setupCreateZCFVat', async t => {
() => undefined, // getZoeService
)(undefined),
{
// @ts-expect-error fakeVatAdminSvc is mocked
adminNode: undefined,
root: undefined,
},
Expand Down

0 comments on commit 63a5077

Please sign in to comment.