mirror of
https://github.com/haveno-dex/haveno-ts.git
synced 2025-07-05 12:04:44 -04:00
skip testing trade stats if trade not completed
This commit is contained in:
parent
8a81a993fe
commit
c13398e8cd
1 changed files with 12 additions and 6 deletions
|
@ -1660,12 +1660,14 @@ test("Can complete a trade within a range", async () => {
|
||||||
let makerPaymentAccount = await createPaymentAccount(user1, assetCode, paymentMethodId); // TODO: support getPaymentAccount() which gets or creates
|
let makerPaymentAccount = await createPaymentAccount(user1, assetCode, paymentMethodId); // TODO: support getPaymentAccount() which gets or creates
|
||||||
let takerPaymentAccount = await createPaymentAccount(user2, assetCode, paymentMethodId);
|
let takerPaymentAccount = await createPaymentAccount(user2, assetCode, paymentMethodId);
|
||||||
|
|
||||||
|
// get trade statistics before
|
||||||
|
const tradeStatisticsPre = await arbitrator.getTradeStatistics();
|
||||||
|
|
||||||
// execute trade
|
// execute trade
|
||||||
const offerAmount = HavenoUtils.xmrToAtomicUnits(2);
|
const offerAmount = HavenoUtils.xmrToAtomicUnits(2);
|
||||||
const offerMinAmount = HavenoUtils.xmrToAtomicUnits(.15);
|
const offerMinAmount = HavenoUtils.xmrToAtomicUnits(.15);
|
||||||
const tradeAmount = getRandomBigIntWithinRange(offerMinAmount, offerAmount);
|
const tradeAmount = getRandomBigIntWithinRange(offerMinAmount, offerAmount);
|
||||||
const tradeStatisticsPre = await arbitrator.getTradeStatistics();
|
const ctx: Partial<TradeContext> = {
|
||||||
await executeTrade({
|
|
||||||
price: 142.23,
|
price: 142.23,
|
||||||
offerAmount: offerAmount,
|
offerAmount: offerAmount,
|
||||||
offerMinAmount: offerMinAmount,
|
offerMinAmount: offerMinAmount,
|
||||||
|
@ -1675,10 +1677,14 @@ test("Can complete a trade within a range", async () => {
|
||||||
takerPaymentAccountId: takerPaymentAccount.getId(),
|
takerPaymentAccountId: takerPaymentAccount.getId(),
|
||||||
assetCode: assetCode,
|
assetCode: assetCode,
|
||||||
testBalanceChangeEndToEnd: true
|
testBalanceChangeEndToEnd: true
|
||||||
});
|
}
|
||||||
const tradeStatisticsPost = await arbitrator.getTradeStatistics();
|
await executeTrade(ctx);
|
||||||
HavenoUtils.log(0, "Trade statistics size before/after trade: " + tradeStatisticsPre.length + "/" + tradeStatisticsPost.length);
|
|
||||||
assert(tradeStatisticsPost.length - tradeStatisticsPre.length === 1);
|
// test trade statistics after
|
||||||
|
if (ctx.buyerSendsPayment && ctx.sellerReceivesPayment) {
|
||||||
|
const tradeStatisticsPost = await arbitrator.getTradeStatistics();
|
||||||
|
assert(tradeStatisticsPost.length - tradeStatisticsPre.length === 1);
|
||||||
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
test("Can complete trades at the same time (CI, sanity check)", async () => {
|
test("Can complete trades at the same time (CI, sanity check)", async () => {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue