Skip to content

Commit 22bf706

Browse files
committed
Test invalid JSON
1 parent d1a1881 commit 22bf706

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

src/__tests__/webhooks/bankingWebhooks.spec.ts

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -543,10 +543,17 @@ describe("BankingWebhooks Tests", function (): void {
543543
expect(disputeNotificationRequest.data.balancePlatform).toBe("YOUR_BALANCE_PLATFORM");
544544
expect(disputeNotificationRequest.data.status).toBe("open");
545545
expect(disputeNotificationRequest.data.type).toBe(DisputeEventNotification.TypeEnum.NotDelivered);
546-
// test getGenericWebhook
546+
// test getGenericWebhook
547547
const genericWebhook = disputeWebhooksHandler.getGenericWebhook();
548548
expect(genericWebhook instanceof DisputeNotificationRequest).toBe(true);
549549
expect(genericWebhook.type).toEqual("balancePlatform.dispute.created");
550550
});
551551

552+
it("should throw SyntaxError when JSON is invalid", function (): void {
553+
const invalidJsonString = "{ invalid json }";
554+
expect(() => {
555+
new DisputeWebhooksHandler(invalidJsonString);
556+
}).toThrowError(SyntaxError);
557+
});
558+
552559
});

0 commit comments

Comments
 (0)