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 Apr 22, 2022
1 parent 989a314 commit f1ded78
Show file tree
Hide file tree
Showing 7 changed files with 14 additions and 18 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@ test('copySet with strings isGTE', t => {
harden({ brand: mockBrand, value: makeCopySet(['a', 'a']) }),
harden({ brand: mockBrand, value: makeCopySet(['b']) }),
),
null,
undefined,
`duplicates in the left of isGTE should throw`,
);
t.throws(
Expand All @@ -135,7 +135,7 @@ test('copySet with strings isGTE', t => {
harden({ brand: mockBrand, value: makeCopySet(['a']) }),
harden({ brand: mockBrand, value: makeCopySet(['b', 'b']) }),
),
null,
undefined,
`duplicates in the right of isGTE should throw`,
);
t.assert(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ test('set with strings isGTE', t => {
harden({ brand: mockBrand, value: ['a', 'a'] }),
harden({ brand: mockBrand, value: ['b'] }),
),
null,
undefined,
`duplicates in the left of isGTE should throw`,
);
t.throws(
Expand All @@ -106,7 +106,7 @@ test('set with strings isGTE', t => {
harden({ brand: mockBrand, value: ['a'] }),
harden({ brand: mockBrand, value: ['b', 'b'] }),
),
null,
undefined,
`duplicates in the right of isGTE should throw`,
);
t.assert(
Expand Down
3 changes: 1 addition & 2 deletions packages/run-protocol/test/psm/test-psm.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,7 @@ import { makeTracer } from '../../src/makeTracer.js';
import { unsafeMakeBundleCache } from '../bundleTool.js';
import { setUpZoeForTest } 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
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';
// 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';
// 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
1 change: 1 addition & 0 deletions packages/run-protocol/test/vaultFactory/test-storeUtils.js
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,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
2 changes: 2 additions & 0 deletions packages/ui-components/test/components/test-NatAmountInput.js
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,7 @@ test('error=true', t => {
});

test('can simulate input - just calls onChange', t => {
/** @type {bigint | undefined} */
let receivedValue;
const onChange = newValue => {
receivedValue = newValue;
Expand Down Expand Up @@ -188,6 +189,7 @@ test('displays 3 eth correctly', t => {
});

test('discards negative values', t => {
/** @type {bigint | undefined} */
let receivedValue;
const onChange = newValue => {
receivedValue = newValue;
Expand Down

0 comments on commit f1ded78

Please sign in to comment.