mirror of
https://github.com/haveno-dex/haveno-ts.git
synced 2025-05-21 16:00:43 -04:00
test chat messages by configuration
This commit is contained in:
parent
897d43dfba
commit
7046924f40
1 changed files with 61 additions and 55 deletions
|
@ -143,6 +143,7 @@ const defaultTradeConfig: Partial<TradeContext> = {
|
||||||
disputeSummary: "Seller is winner",
|
disputeSummary: "Seller is winner",
|
||||||
walletSyncPeriodMs: 5000,
|
walletSyncPeriodMs: 5000,
|
||||||
maxTimePeerNoticeMs: 5000,
|
maxTimePeerNoticeMs: 5000,
|
||||||
|
testChatMessages: true,
|
||||||
stopOnFailure: true,
|
stopOnFailure: true,
|
||||||
testPayoutConfirmed: true,
|
testPayoutConfirmed: true,
|
||||||
testPayoutUnlocked: false,
|
testPayoutUnlocked: false,
|
||||||
|
@ -218,6 +219,7 @@ class TradeContext {
|
||||||
sellerOpenedDispute?: boolean;
|
sellerOpenedDispute?: boolean;
|
||||||
walletSyncPeriodMs: number;
|
walletSyncPeriodMs: number;
|
||||||
maxTimePeerNoticeMs: number;
|
maxTimePeerNoticeMs: number;
|
||||||
|
testChatMessages: boolean;
|
||||||
stopOnFailure?: boolean;
|
stopOnFailure?: boolean;
|
||||||
buyerAppName?: string;
|
buyerAppName?: string;
|
||||||
sellerAppName?: string;
|
sellerAppName?: string;
|
||||||
|
@ -2924,6 +2926,9 @@ async function testOpenDispute(ctxP: Partial<TradeContext>) {
|
||||||
await ctx.getDisputePeer()!.havenod!.addNotificationListener(notification => { HavenoUtils.log(3, "Dispute peer received notification " + notification.getType() + " " + (notification.getChatMessage() ? notification.getChatMessage()?.getMessage() : "")); disputePeerNotifications.push(notification); });
|
await ctx.getDisputePeer()!.havenod!.addNotificationListener(notification => { HavenoUtils.log(3, "Dispute peer received notification " + notification.getType() + " " + (notification.getChatMessage() ? notification.getChatMessage()?.getMessage() : "")); disputePeerNotifications.push(notification); });
|
||||||
await arbitrator.addNotificationListener(notification => { HavenoUtils.log(3, "Arbitrator received notification " + notification.getType() + " " + (notification.getChatMessage() ? notification.getChatMessage()?.getMessage() : "")); arbitratorNotifications.push(notification); });
|
await arbitrator.addNotificationListener(notification => { HavenoUtils.log(3, "Arbitrator received notification " + notification.getType() + " " + (notification.getChatMessage() ? notification.getChatMessage()?.getMessage() : "")); arbitratorNotifications.push(notification); });
|
||||||
|
|
||||||
|
// test chat messages
|
||||||
|
if (ctx.testChatMessages) {
|
||||||
|
|
||||||
// arbitrator sends chat messages to traders
|
// arbitrator sends chat messages to traders
|
||||||
HavenoUtils.log(1, "Arbitrator sending chat messages to traders. tradeId=" + ctx.offerId + ", disputeId=" + openerDispute.getId());
|
HavenoUtils.log(1, "Arbitrator sending chat messages to traders. tradeId=" + ctx.offerId + ", disputeId=" + openerDispute.getId());
|
||||||
await ctx.arbitrator.havenod!.sendDisputeChatMessage(arbDisputeOpener!.getId(), "Arbitrator chat message to dispute opener", []);
|
await ctx.arbitrator.havenod!.sendDisputeChatMessage(arbDisputeOpener!.getId(), "Arbitrator chat message to dispute opener", []);
|
||||||
|
@ -2984,6 +2989,7 @@ async function testOpenDispute(ctxP: Partial<TradeContext>) {
|
||||||
expect(attachments[1].getBytes()).toEqual(bytes2);
|
expect(attachments[1].getBytes()).toEqual(bytes2);
|
||||||
expect(chatNotifications[1].getChatMessage()?.getMessage()).toEqual("Dispute peer chat message");
|
expect(chatNotifications[1].getChatMessage()?.getMessage()).toEqual("Dispute peer chat message");
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
async function resolveDispute(ctxP: Partial<TradeContext>) {
|
async function resolveDispute(ctxP: Partial<TradeContext>) {
|
||||||
let ctx = TradeContext.init(ctxP);
|
let ctx = TradeContext.init(ctxP);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue