Skip to content

Commit

Permalink
refactor: use lib
Browse files Browse the repository at this point in the history
  • Loading branch information
turadg committed Aug 27, 2024
1 parent 659c1fb commit 0d27133
Show file tree
Hide file tree
Showing 4 changed files with 92 additions and 477 deletions.
151 changes: 0 additions & 151 deletions proposals/64:crabble-start/core-eval-support.js

This file was deleted.

2 changes: 1 addition & 1 deletion proposals/64:crabble-start/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
"type": "module",
"license": "Apache-2.0",
"dependencies": {
"@agoric/synthetic-chain": "^0.0.1-rc0",
"@agoric/synthetic-chain": "^0.1.1",
"@endo/zip": "^0.2.35",
"ava": "^5.3.1",
"better-sqlite3": "^8.5.1",
Expand Down
35 changes: 25 additions & 10 deletions proposals/64:crabble-start/test-crabble-start.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,12 @@
*/

import anyTest from 'ava';
import dbOpenAmbient from 'better-sqlite3';
import * as cpAmbient from 'child_process'; // TODO: use execa
import * as fspAmbient from 'fs/promises';
import { tmpName as tmpNameAmbient } from 'tmp';
import * as pathAmbient from 'path';
import * as processAmbient from 'process';
import dbOpenAmbient from 'better-sqlite3';
import { tmpName as tmpNameAmbient } from 'tmp';

// TODO: factor out ambient authority from these
// or at least allow caller to supply authority.
Expand All @@ -34,25 +34,40 @@ import {
waitForBlock,
} from '@agoric/synthetic-chain/src/lib/commonUpgradeHelpers.js';

import { makeAgd } from '@agoric/synthetic-chain/src/lib/agd-lib.js';
import { dbTool } from '@agoric/synthetic-chain/src/lib/vat-status.js';
import {
makeFileRd,
makeFileRW,
} from '@agoric/synthetic-chain/src/lib/webAsset.js';
import {
ensureISTForInstall,
flags,
getContractInfo,
loadedBundleIds,
testIncludes,
txAbbr,
} from './core-eval-support.js';
} from '@agoric/synthetic-chain';
import { makeAgd } from '@agoric/synthetic-chain/src/lib/agd-lib.js';
import { dbTool } from '@agoric/synthetic-chain/src/lib/vat-status.js';
import {
makeFileRd,
makeFileRW,
} from '@agoric/synthetic-chain/src/lib/webAsset.js';

/** @typedef {Awaited<ReturnType<typeof makeTestContext>>} TestContext */

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

/**
* Asserts that `haystack` includes `needle` (or when `sense` is false, that it
* does not), providing pretty output in the case of failure.
*
* @param {import('ava').ExecutionContext} t
* @param {unknown} needle
* @param {unknown[]} haystack
* @param {string} label
* @param {boolean} [sense] true to assert inclusion; false for exclusion
* @returns {void}
*/
export const testIncludes = (t, needle, haystack, label, sense = true) => {
const matches = haystack.filter(c => Object.is(c, needle));
t.deepEqual(matches, sense ? [needle] : [], label);
};

const assetInfo = {
/** @type {Record<string, ProposalInfo>} */
buildAssets: {
Expand Down
Loading

0 comments on commit 0d27133

Please sign in to comment.