fix jest hanging in offline tests on funding error

This commit is contained in:
woodser 2023-04-05 08:42:55 -04:00
parent 4b21957de1
commit b8016eda54

View file

@ -1388,12 +1388,9 @@ test("Can go offline while completing a trade (CI, sanity check)", async () => {
let err: any; let err: any;
try { try {
// start and fund 2 trader processes // start 2 trader processes
HavenoUtils.log(1, "Starting trader processes"); HavenoUtils.log(1, "Starting trader processes");
traders = await initHavenos(2); traders = await initHavenos(2);
HavenoUtils.log(1, "Funding traders");
const tradeAmount = BigInt("250000000000");
await waitForAvailableBalance(tradeAmount * BigInt("2"), ...traders);
// create trade config // create trade config
ctx = Object.assign({}, TestConfig.trade); ctx = Object.assign({}, TestConfig.trade);
@ -1403,6 +1400,11 @@ test("Can go offline while completing a trade (CI, sanity check)", async () => {
ctx.sellerOfflineAfterTake = true; ctx.sellerOfflineAfterTake = true;
ctx.buyerOfflineAfterPaymentSent = true; ctx.buyerOfflineAfterPaymentSent = true;
// fund traders
HavenoUtils.log(1, "Funding traders");
const tradeAmount = BigInt("250000000000");
await waitForAvailableBalance(tradeAmount * BigInt("2"), ...traders);
// execute trade // execute trade
await executeTrade(ctx); await executeTrade(ctx);
} catch (e) { } catch (e) {
@ -1421,12 +1423,9 @@ test("Can go offline while resolving disputes (CI)", async () => {
let err: any; let err: any;
try { try {
// start and fund 2 trader processes // start trader processes
HavenoUtils.log(1, "Starting trader processes"); HavenoUtils.log(1, "Starting trader processes");
traders = await initHavenos(2); traders = await initHavenos(2);
HavenoUtils.log(1, "Funding traders");
const tradeAmount = BigInt("250000000000");
await waitForAvailableBalance(tradeAmount * BigInt("2"), ...traders);
// create trade config // create trade config
ctx = Object.assign(getTradeContexts(1)[0], { ctx = Object.assign(getTradeContexts(1)[0], {
@ -1441,6 +1440,11 @@ test("Can go offline while resolving disputes (CI)", async () => {
disputeSummary: "Seller wins dispute because buyer has not replied", disputeSummary: "Seller wins dispute because buyer has not replied",
}); });
// fund traders
HavenoUtils.log(1, "Funding traders");
const tradeAmount = BigInt("250000000000");
await waitForAvailableBalance(tradeAmount * BigInt("2"), ...traders);
// execute trade // execute trade
await executeTrade(ctx); await executeTrade(ctx);
} catch (e) { } catch (e) {