Skip to content

Commit

Permalink
chore(a3p): restore localchain test
Browse files Browse the repository at this point in the history
  • Loading branch information
mhofman committed Jun 22, 2024
1 parent a4f86eb commit d36382d
Show file tree
Hide file tree
Showing 2 changed files with 34 additions and 0 deletions.
33 changes: 33 additions & 0 deletions a3p-integration/proposals/a:upgrade-next/localchain.test.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
import test from 'ava';

import { agd, evalBundles, waitForBlock } from '@agoric/synthetic-chain';

const SUBMISSION_DIR = 'localchaintest-submission';

const readPublished = async path => {
const { value } = await agd.query(
'vstorage',
'data',
'--output',
'json',
`published.${path}`,
);
if (value === '') {
return undefined;
}
const obj = JSON.parse(value);
return obj.values[0];
};

// 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 nodeValue = JSON.stringify({ success: true });

await waitForBlock(2); // enough time for core eval to execute ?

t.is(await readPublished(nodePath), nodeValue);
});
1 change: 1 addition & 0 deletions a3p-integration/proposals/a:upgrade-next/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
"coreProposals": []
},
"sdk-generate": [
"vats/test-localchain.js localchaintest-submission",
"vats/upgrade-bank.js upgrade-bank",
"vats/upgrade-provisionPool.js upgrade-provisionPool",
"testing/add-LEMONS.js add-LEMONS",
Expand Down

0 comments on commit d36382d

Please sign in to comment.