Skip to content

Commit

Permalink
fixup! fix(lint): tests
Browse files Browse the repository at this point in the history
  • Loading branch information
turadg committed Sep 13, 2024
1 parent 28d5872 commit 064eb83
Showing 1 changed file with 8 additions and 17 deletions.
25 changes: 8 additions & 17 deletions contract/test/test-build-proposal.js
Original file line number Diff line number Diff line change
@@ -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<Buffer>} compressFile
* @typedef {{
* compressFile: (path: string) => Promise<Buffer>,
* }} TestContext
*/

/**
* @param {ExecutionContext<TestContext>} t
*/
const test = /** @type {import('ava').TestFn<TestContext>}} */ (anyTest);

test.before(t => {
t.context = {
compressFile: makeCompressFile(fs.readFile),
};
});

/**
* @param {ExecutionContext<TestContext>} 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',
});
Expand All @@ -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
Expand Down

0 comments on commit 064eb83

Please sign in to comment.