expect payout published at end of test (#143)

This commit is contained in:
woodser 2022-10-02 14:41:54 -04:00 committed by GitHub
parent 4b5f412fe1
commit 8fb88e8703
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -1828,8 +1828,7 @@ async function executeTrade(config?: TradeConfig): Promise<string> {
HavenoUtils.log(1, "Seller confirming payment received");
await config.seller.confirmPaymentReceived(trade.getTradeId());
fetchedTrade = await config.seller.getTrade(trade.getTradeId());
if (config.buyerOfflineAfterTake) expect(fetchedTrade.getPhase()).toEqual("PAYMENT_RECEIVED"); // TODO (woodser): test buyer offline so doesn't send multisig info after first confirmation
else expect(fetchedTrade.getPhase()).toEqual("PAYOUT_PUBLISHED");
expect(fetchedTrade.getPhase()).toEqual(config.sellerOfflineAfterTake ? "PAYMENT_RECEIVED" : "PAYOUT_PUBLISHED"); // payout can only be published if seller remained online after first confirmation to share updated multisig info
// buyer comes online if offline
if (config.buyerOfflineAfterPaymentSent) {
@ -1844,10 +1843,12 @@ async function executeTrade(config?: TradeConfig): Promise<string> {
fetchedTrade = await config.buyer.getTrade(trade.getTradeId());
expect(fetchedTrade.getPhase()).toEqual("PAYOUT_PUBLISHED"); // TODO: this should be WITHDRAW_COMPLETED?
fetchedTrade = await config.seller.getTrade(trade.getTradeId());
expect(fetchedTrade.getPhase()).toEqual(config.sellerOfflineAfterTake ? "PAYMENT_RECEIVED" : "PAYOUT_PUBLISHED"); // payout can only be published if seller remained online after first confirmation to share updated multisig info
expect(fetchedTrade.getPhase()).toEqual("PAYOUT_PUBLISHED");
const arbitratorTrade = await config.arbitrator.getTrade(trade.getTradeId());
expect(arbitratorTrade.getState()).toEqual("WITHDRAW_COMPLETED");
// TODO: traders mark trades as complete
// test balances after payout tx unless other trades can interfere
if (!config.concurrentTrades) {
const buyerBalancesAfter = await config.buyer.getBalances();