Skip to content

Commit

Permalink
test: rm readPublished helper
Browse files Browse the repository at this point in the history
  • Loading branch information
turadg committed Nov 7, 2024
1 parent b97d772 commit 7c9e695
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 14 deletions.
13 changes: 5 additions & 8 deletions a3p-integration/proposals/z:acceptance/core-eval.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@ import { retryUntilCondition } from '@agoric/client-utils';

import { walletUtils } from './test-lib/index.js';

const { readLatest } = walletUtils.vstorage;

const SUBMISSION_DIR = 'core-eval-test-submission';

/**
Expand All @@ -22,16 +24,11 @@ const replaceTemplateValuesInFile = async (fileName, replacements) => {
await writeFile(`${fileName}.js`, script);
};

/** @param {string} path } */
const readPublished = async path => {
return walletUtils.vstorage.readLatest(`published.${path}`);
};

test(`core eval works`, async t => {
const nodePath = 'foo.bar';
const nodePath = 'published.foo.bar';
const nodeValue = 'baz';

await t.throwsAsync(readPublished(nodePath), {
await t.throwsAsync(readLatest(nodePath), {
message: /not found/,
});

Expand All @@ -43,7 +40,7 @@ test(`core eval works`, async t => {
await evalBundles(SUBMISSION_DIR);

const actualValue = await retryUntilCondition(
async () => readPublished(nodePath),
async () => readLatest(nodePath),
value => value === nodeValue,
'core eval not processed yet',
{ setTimeout, retryIntervalMs: 5000, maxRetries: 15 },
Expand Down
9 changes: 3 additions & 6 deletions a3p-integration/proposals/z:acceptance/localchain.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,21 +7,18 @@ import { walletUtils } from './test-lib/index.js';

const SUBMISSION_DIR = 'localchaintest-submission';

/** @param {string} path } */
const readPublished = async path => {
return walletUtils.vstorage.readLatest(`published.${path}`);
};
const { readLatest } = walletUtils.vstorage;

// The testing assertions are in the submission that runs in the core-eval.
// The test here runs that and confirms the eval made it through all the assertions.
test(`localchain passes tests`, async t => {
await evalBundles(SUBMISSION_DIR);

const nodePath = 'test.localchain';
const nodePath = 'published.test.localchain';
const nodeValue = JSON.stringify({ success: true });

const actualValue = await retryUntilCondition(
async () => readPublished(nodePath),
() => readLatest(nodePath),
value => value === nodeValue,
'core eval not processed yet',
{ setTimeout, retryIntervalMs: 5000, maxRetries: 15 },
Expand Down

0 comments on commit 7c9e695

Please sign in to comment.