-
Notifications
You must be signed in to change notification settings - Fork 208
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
2 changed files
with
34 additions
and
0 deletions.
There are no files selected for viewing
33 changes: 33 additions & 0 deletions
33
a3p-integration/proposals/a:upgrade-next/localchain.test.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters