Skip to content

Commit e35befc

Browse files
committed
simulate common currency by preferring index 0
1 parent 79c56f5 commit e35befc

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/HavenoClient.test.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2531,7 +2531,7 @@ test("Can bootstrap a network", async () => {
25312531
if (await isFixedPrice(ctxP)) ctxP.price = ctxP.direction === OfferDirection.BUY ? getRandomFloat(125, 155) : getRandomFloat(160, 190);
25322532

25332533
// randomize trade config
2534-
if (ctxP.takeOffer === undefined) ctxP.takeOffer = getRandomOutcome(3/5);
2534+
if (ctxP.takeOffer === undefined) ctxP.takeOffer = getRandomOutcome(1/2);
25352535
if (ctxP.tradeAmount === undefined) ctxP.tradeAmount = isRangeOffer ? getRandomBigIntWithinRange(ctxP.offerMinAmount!, ctxP.offerAmount) : ctxP.offerAmount;
25362536
if (ctxP.buyerSendsPayment === undefined) ctxP.buyerSendsPayment = completeAllTrades || getRandomOutcome(1/2);
25372537
if (ctxP.priceMargin === undefined && ctxP.price === undefined) ctxP.priceMargin = parseFloat(getRandomFloat(0, .3).toFixed(10));
@@ -4545,7 +4545,7 @@ function getValidFormInputAux(form: PaymentAccountForm, fieldId: PaymentAccountF
45454545
if (field.getComponent() === PaymentAccountFormField.Component.SELECT_ONE) {
45464546
if (form.getId() === PaymentAccountForm.FormId.F2F) return "XAU";
45474547
if (form.getId() === PaymentAccountForm.FormId.PAY_BY_MAIL) return "XGB";
4548-
let randomIndex = moneroTs.GenUtils.getRandomInt(0, field.getSupportedCurrenciesList().length - 1);
4548+
let randomIndex = getRandomOutcome(2/3) ? 0 : moneroTs.GenUtils.getRandomInt(0, field.getSupportedCurrenciesList().length - 1); // prefer index 0 to simulate common currency
45494549
return field.getSupportedCurrenciesList()[randomIndex]!.getCode();
45504550
}
45514551
else return field.getSupportedCurrenciesList().map(currency => currency.getCode()).join(',');

0 commit comments

Comments
 (0)