diff --git a/solarkraft/src/fetch.ts b/solarkraft/src/fetch.ts index b4c46d92..bd00b840 100644 --- a/solarkraft/src/fetch.ts +++ b/solarkraft/src/fetch.ts @@ -56,7 +56,9 @@ export async function fetch(args: any) { // https://github.com/stellar/js-stellar-sdk/blob/master/test/integration/streaming_test.js clearTimeout(timeout) closeHandler() - console.error(err) + if (err) { + console.error(err) + } } // the number of received events diff --git a/solarkraft/test/e2e/fetch.test.ts b/solarkraft/test/e2e/fetch.test.ts new file mode 100644 index 00000000..b4a75c45 --- /dev/null +++ b/solarkraft/test/e2e/fetch.test.ts @@ -0,0 +1,20 @@ +// Integration tests for the `verify` command + +import { describe, it } from 'mocha' + +import { spawn } from 'nexpect' + +describe('fetch', () => { + it('fetches transactions', function (done) { + this.timeout(50000) + spawn( + 'solarkraft fetch --rpc https://horizon-testnet.stellar.org --id CC22QGTOUMERDNIYN7TPNX3V6EMPHQXVSRR3XY56EADF7YTFISD2ROND --height 1638368 --timeout 10' + ) + .wait( + 'Target contract: CC22QGTOUMERDNIYN7TPNX3V6EMPHQXVSRR3XY56EADF7YTFISD2ROND' + ) + .wait('Fetching the ledger for 1638368') + .wait('+ save: 1638383') + .run(done) + }) +})