From 064eb83d715eac8797da512aecf067bbd2f75d8f Mon Sep 17 00:00:00 2001 From: Turadg Aleahmad Date: Fri, 13 Sep 2024 09:51:28 -0700 Subject: [PATCH] fixup! fix(lint): tests --- contract/test/test-build-proposal.js | 25 ++++++++----------------- 1 file changed, 8 insertions(+), 17 deletions(-) diff --git a/contract/test/test-build-proposal.js b/contract/test/test-build-proposal.js index 71265d9..72d5016 100644 --- a/contract/test/test-build-proposal.js +++ b/contract/test/test-build-proposal.js @@ -1,31 +1,24 @@ /* eslint-disable import/order -- https://github.com/endojs/endo/issues/1235 */ -import { test } from './prepare-test-env-ava.js'; +import { test as anyTest } from './prepare-test-env-ava.js'; import { execSync } from 'node:child_process'; import { promises as fs } from 'node:fs'; import { makeCompressFile } from './utils.js'; /** - * @import {ExecutionContext} from 'ava'; - */ -/** - * @typedef {object} TestContext - * @property {function(any): Promise} compressFile + * @typedef {{ + * compressFile: (path: string) => Promise, + * }} TestContext */ -/** - * @param {ExecutionContext} t - */ +const test = /** @type {import('ava').TestFn}} */ (anyTest); + test.before(t => { t.context = { compressFile: makeCompressFile(fs.readFile), }; }); -/** - * @param {ExecutionContext} t - */ - -test.only('proposal builder generates compressed bundles less than 1MB', async t => { +test('proposal builder generates compressed bundles less than 1MB', async t => { const stdout = execSync('agoric run scripts/build-contract-deployer.js', { encoding: 'utf8', }); @@ -38,9 +31,7 @@ test.only('proposal builder generates compressed bundles less than 1MB', async t for (const bundle of bundles) { // eslint-disable-next-line @jessie.js/safe-await-separator - const buffer = await /** @type {TestContext} */ (t.context).compressFile( - bundle, - ); + const buffer = await t.context.compressFile(bundle); t.assert(buffer); const sizeInMb = buffer.length / (1024 * 1024); // JSON RPC hex encoding doubles the size