-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #64 from freespek/igor/list
add a simple implementation of `solarkraft list`
- Loading branch information
Showing
4 changed files
with
142 additions
and
19 deletions.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
// Integration tests for the `verify` command | ||
|
||
import { describe, it } from 'mocha' | ||
|
||
import { spawn } from 'nexpect' | ||
import { mkdtempSync } from 'node:fs' | ||
import { tmpdir } from 'node:os' | ||
import { join } from 'node:path' | ||
import { saveContractCallEntry } from '../../src/fetcher/storage.js' | ||
import { OrderedMap } from 'immutable' | ||
|
||
const TX_HASH = | ||
'9fb12935fbadcd28aa220d076f11be631590d22c60977a53997a746898322ca3' | ||
const CONTRACT_ID = 'CC22QGTOUMERDNIYN7TPNX3V6EMPHQXVSRR3XY56EADF7YTFISD2ROND' | ||
|
||
describe('list', () => { | ||
it('lists a single entry', function (done) { | ||
// create a single entry in a temporary directory | ||
const root = join(tmpdir(), 'solarkraft-storage-') | ||
mkdtempSync(root) | ||
saveContractCallEntry(root, { | ||
height: 1000, | ||
txHash: TX_HASH, | ||
contractId: CONTRACT_ID, | ||
method: 'set_i32', | ||
methodArgs: [42], | ||
returnValue: 0, | ||
fields: OrderedMap<string, any>(), | ||
oldFields: OrderedMap<string, any>(), | ||
}) | ||
|
||
this.timeout(50000) | ||
spawn(`solarkraft list --home ${root}`) | ||
.wait(`Contract ${CONTRACT_ID}`) | ||
.wait(' [unverified]') | ||
.wait(' height: 1000') | ||
.wait(` tx: ${TX_HASH}`) | ||
.run(done) | ||
}) | ||
}) |