chore: fix test flakiness and add mock helper (#10956)

This commit is contained in:
Justin Starry
2020-07-08 20:46:16 +08:00
committed by GitHub
parent e50227745d
commit c06505934f
3 changed files with 89 additions and 72 deletions

View File

@@ -0,0 +1,31 @@
// @flow
import type {TransactionSignature} from '../../src/transaction';
import {url} from '../url';
import {mockRpc} from '../__mocks__/node-fetch';
export function mockConfirmTransaction(signature: TransactionSignature) {
mockRpc.push([
url,
{
method: 'getSignatureStatuses',
params: [[signature]],
},
{
error: null,
result: {
context: {
slot: 11,
},
value: [
{
slot: 0,
confirmations: null,
status: {Ok: null},
err: null,
},
],
},
},
]);
}