-
Notifications
You must be signed in to change notification settings - Fork 217
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
test: lint Ava tests #4981
Merged
Merged
test: lint Ava tests #4981
Changes from all commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
4aea0e5
chore(deps): bump eslint to latest (8.47.0)
turadg 8cd45e9
yarn add --dev eslint-plugin-ava
turadg 1a7503e
chore(deps): npx yarn-deduplicate
turadg 4c46db2
ci(lint): adopt plugin:ava/recommended
turadg 701a131
test: factor out exports module
turadg 7347734
chore: comply with ava/recommended eslint
turadg File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
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
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
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
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
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
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
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
2 changes: 2 additions & 0 deletions
2
packages/governance/test/swingsetTests/committeeBinary/test-committee.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
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
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
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
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
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
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
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,99 @@ | ||
import { Buffer } from 'buffer'; | ||
import { makeB0ID } from './util.js'; | ||
|
||
export const snapshotData = 'snapshot data'; | ||
// this snapHash was computed manually | ||
export const snapHash = | ||
'e7dee7266896538616b630a5da40a90e007726a383e005a9c9c5dd0c2daf9329'; | ||
|
||
/** @type {import('../src/bundleStore.js').Bundle} */ | ||
export const bundle0 = { moduleFormat: 'nestedEvaluate', source: '1+1' }; | ||
export const bundle0ID = makeB0ID(bundle0); | ||
|
||
export function buildData() { | ||
// build an export manually | ||
const exportData = new Map(); | ||
const artifacts = new Map(); | ||
|
||
// shadow kvStore | ||
exportData.set('kv.key1', 'value1'); | ||
|
||
// now add artifacts and metadata in pairs | ||
|
||
artifacts.set(`bundle.${bundle0ID}`, JSON.stringify(bundle0)); | ||
exportData.set(`bundle.${bundle0ID}`, bundle0ID); | ||
|
||
const sbase = { vatID: 'v1', hash: snapHash, inUse: 0 }; | ||
const tbase = { vatID: 'v1', startPos: 0, isCurrent: 0, incarnation: 1 }; | ||
const addTS = (key, obj) => | ||
exportData.set(key, JSON.stringify({ ...tbase, ...obj })); | ||
const t0hash = | ||
'5bee0f44eca02f23eab03703e84ed2647d5d117fed99e1c30a3b424b7f082ab9'; | ||
const t2hash = | ||
'57152efdd7fdf75c03371d2b4f1088d5bf3eae7fe643babce527ff81df38998c'; | ||
const t5hash = | ||
'1947001e78e01bd1e773feb22b4ffc530447373b9de9274d5d5fbda3f23dbf2b'; | ||
const t8hash = | ||
'e6b42c6a3fb94285a93162f25a9fc0145fd4c5bb144917dc572c50ae2d02ee69'; | ||
|
||
addTS(`transcript.v1.0`, { incarnation: 0, endPos: 2, hash: t0hash }); | ||
artifacts.set(`transcript.v1.0.2`, 'start-worker\nshutdown-worker\n'); | ||
|
||
addTS(`transcript.v1.2`, { startPos: 2, endPos: 5, hash: t2hash }); | ||
artifacts.set( | ||
`transcript.v1.2.5`, | ||
'start-worker\ndelivery1\nsave-snapshot\n', | ||
); | ||
exportData.set(`snapshot.v1.4`, JSON.stringify({ ...sbase, snapPos: 4 })); | ||
artifacts.set(`snapshot.v1.4`, snapshotData); | ||
|
||
addTS(`transcript.v1.5`, { startPos: 5, endPos: 8, hash: t5hash }); | ||
artifacts.set( | ||
'transcript.v1.5.8', | ||
'load-snapshot\ndelivery2\nsave-snapshot\n', | ||
); | ||
exportData.set( | ||
`snapshot.v1.7`, | ||
JSON.stringify({ ...sbase, snapPos: 7, inUse: 1 }), | ||
); | ||
artifacts.set(`snapshot.v1.7`, snapshotData); | ||
|
||
artifacts.set('transcript.v1.8.10', 'load-snapshot\ndelivery3\n'); | ||
exportData.set(`snapshot.v1.current`, 'snapshot.v1.7'); | ||
addTS(`transcript.v1.current`, { | ||
startPos: 8, | ||
endPos: 10, | ||
isCurrent: 1, | ||
hash: t8hash, | ||
}); | ||
|
||
return { exportData, artifacts, t0hash, t2hash, t5hash, t8hash }; | ||
} | ||
|
||
/** | ||
* @param { Map<string, string | null> } exportData | ||
* @param { Map<string, string> } artifacts | ||
*/ | ||
export function makeExporter(exportData, artifacts) { | ||
return { | ||
async *getExportData() { | ||
for (const [key, value] of exportData.entries()) { | ||
/** @type { import('../src/exporter.js').KVPair } */ | ||
const pair = [key, value]; | ||
yield pair; | ||
} | ||
}, | ||
async *getArtifactNames() { | ||
for (const name of artifacts.keys()) { | ||
yield name; | ||
} | ||
}, | ||
async *getArtifact(name) { | ||
const data = artifacts.get(name); | ||
assert(data, `missing artifact ${name}`); | ||
yield Buffer.from(data); | ||
}, | ||
// eslint-disable-next-line no-empty-function | ||
async close() {}, | ||
}; | ||
} |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
remark: Good extraction!