test: add confirmation retries when testing live
This commit is contained in:
parent
70d22476cf
commit
bc097ec04b
|
@ -8,6 +8,7 @@ import {
|
||||||
import {mockRpc, mockRpcEnabled} from './__mocks__/node-fetch';
|
import {mockRpc, mockRpcEnabled} from './__mocks__/node-fetch';
|
||||||
import {mockGetLastId} from './mockrpc/getlastid';
|
import {mockGetLastId} from './mockrpc/getlastid';
|
||||||
import {url} from './url';
|
import {url} from './url';
|
||||||
|
import {sleep} from '../src/util/sleep';
|
||||||
|
|
||||||
if (!mockRpcEnabled) {
|
if (!mockRpcEnabled) {
|
||||||
// The default of 5 seconds is too slow for live testing sometimes
|
// The default of 5 seconds is too slow for live testing sometimes
|
||||||
|
@ -307,7 +308,17 @@ test('transaction', async () => {
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
);
|
);
|
||||||
await expect(connection.confirmTransaction(signature)).resolves.toBe(true);
|
|
||||||
|
let i = 0;
|
||||||
|
for (;;) {
|
||||||
|
if (await connection.confirmTransaction(signature)) {
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
expect(mockRpcEnabled).toBe(false);
|
||||||
|
expect(++i).toBeLessThan(10);
|
||||||
|
await sleep(500);
|
||||||
|
}
|
||||||
|
|
||||||
mockRpc.push([
|
mockRpc.push([
|
||||||
url,
|
url,
|
||||||
|
|
Loading…
Reference in New Issue