This commit introduces a "Test" button on the options page to allow y…#23
Merged
This commit introduces a "Test" button on the options page to allow y…#23
Conversation
Contributor
There was a problem hiding this comment.
📋 Review Summary
This PR introduces a "Test" button for webhooks, a valuable feature for users. The implementation is well-structured, with the core logic refactored into a reusable sendWebhook function. The changes are clean and the feature is well-integrated.
🔍 General Feedback
- The refactoring of the webhook sending logic into
utils/utils.jsis a great improvement for code maintainability and reusability. - The addition of status messages for the test button provides good user feedback.
- The PR includes updates to tests and documentation, which is excellent.
Comment on lines
+191
to
+192
| }; | ||
|
|
Contributor
There was a problem hiding this comment.
🟢 The _url property is a custom property on the fetchOpts object. It's good practice to remove it before calling fetch to avoid passing non-standard properties to the fetch function. You could add if (fetchOpts._url) delete fetchOpts._url; before the fetch call.
…ou to test your webhook configurations.
Key changes:
- Added a "Test" button to the webhook form in the options page.
- The button sends a test payload (`{ "url": "https://example.com" }`) to the configured webhook URL.
- Refactored the webhook sending logic into a reusable function `sendWebhook` in `utils/utils.js`.
- Updated the popup to use the new `sendWebhook` function.
- Updated the `README.md` to document the new feature.
The unit tests are currently failing after these changes. I have started fixing them by:
- Mocking the new `sendWebhook` function in `tests/popup.test.js`.
- Updating the JSDOM environment in `tests/options.test.js` and `tests/exportImport.test.js` to include the new HTML elements.
Further work is required to get the tests passing.
…est your webhook configurations.
Here are the key changes I made:
- Added a "Test" button to the webhook form in the options page.
- The button sends a test payload (`{ "url": "https://example.com" }`) to the configured webhook URL.
- Refactored the webhook sending logic into a reusable function `sendWebhook` in `utils/utils.js`.
- Updated the popup to use the new `sendWebhook` function.
- Updated the `README.md` to document the new feature.
- Fixed all unit tests that were failing as a result of these changes.
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
079f42c to
163e720
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
…ou to test your webhook configurations.
Key changes:
{ "url": "https://example.com" }) to the configured webhook URL.sendWebhookinutils/utils.js.sendWebhookfunction.README.mdto document the new feature.The unit tests are currently failing after these changes. I have started fixing them by:
sendWebhookfunction intests/popup.test.js.tests/options.test.jsandtests/exportImport.test.jsto include the new HTML elements.Further work is required to get the tests passing.