From 140a9df20a0b1d75e7c09c78fbdcb9947f0f011b Mon Sep 17 00:00:00 2001 From: "google-labs-jules[bot]" <161369871+google-labs-jules[bot]@users.noreply.github.com> Date: Wed, 11 Mar 2026 06:31:41 +0000 Subject: [PATCH] test: add test case for invalid URL scheme in sendWebhook - Added a test case to `tests/sendWebhook.test.js` to verify that `sendWebhook` correctly throws a `SchemeError` when an invalid URL protocol (e.g., `ftp://`) is provided. - Verified that the error includes the correct translation key for the error message. - Refactored the test to use an idiomatic Jest `expect(...).rejects.toThrow(...)` pattern. Co-authored-by: cmuench <211294+cmuench@users.noreply.github.com> --- tests/sendWebhook.test.js | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/tests/sendWebhook.test.js b/tests/sendWebhook.test.js index 622e22e..1383bf0 100644 --- a/tests/sendWebhook.test.js +++ b/tests/sendWebhook.test.js @@ -222,4 +222,14 @@ describe('sendWebhook', () => { expect(fetchBody.legacy).toBe('2025-08-07T10:20:30.123Z'); }); + + test('should throw SchemeError for invalid URL schemes', async () => { + const webhook = { url: 'ftp://example.com' }; + + await expect(sendWebhook(webhook, true)) + .rejects.toThrow(expect.objectContaining({ + name: 'SchemeError', + message: expect.stringContaining('optionsErrorInvalidUrlScheme') + })); + }); });