Repository navigation
Fix: Test webhookHistoryToCSV - #1020
Merged
Merged
Conversation
Co-authored-by: Simple Agent <agent@simple.dev>
|
@popsman01 Great news! 🎉 Based on an automated assessment of this PR, the linked Wave issue(s) no longer count against your application limits. You can now already apply to more issues while waiting for a review of this PR. Keep up the great work! 🚀 |
3 tasks
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.
Closes #932
Issues
#932 Test webhookHistoryToCSV
Summary
Reuse the existing
escapeCSVbehavior for assertions: fields containing,,",\n, or\rare wrapped in double quotes and embedded quotes are doubled. Use fixed timestamps (e.g. 1_700_000_000_000 ms) sonew Date(deliveredAt).toISOString()is deterministic. Keep the new tests in the existing__tests__/lib/export.test.tsto avoid a new file. Thelib/export.tsstep is a conditional no-op unless a bug is uncovered.Changes
describe('webhookHistoryToCSV', ...)block to the existing test file. ImportwebhookHistoryToCSVfrom@/lib/exportalongsidestreamsToCSV. Create a small fixture helper that builds delivery objects of shape{ webhookId, eventType, statusCode, deliveredAt, success }. Add tests asserting: (1) the first line equals the expected header rowWebhook ID,Event Type,Status Code,Delivered At,Success; (2) the number of lines equalshistory.length + 1(one row per delivery) and that each row contains the delivery's webhookId/eventType/status; (3) astatusCodeofnullrenders as an empty field; (4)successrenders astrue/false; (5) values containing commas (e.g. webhookIdid,with,commas) are wrapped in double quotes, and values containing double quotes (e.g.he said "hi") are escaped by doubling the quotes and wrapping the field in quotes. Runnpm testto confirm the new tests pass and the coverage report showswebhookHistoryToCSVis exercised. (tests/lib/export.test.ts)webhookHistoryToCSV(e.g. incorrect escaping, wrong header, or wrong row count). The current implementation already uses the sharedescapeCSV/rowhelpers, so no change is expected; if a defect is found, apply the minimal fix and document it in the PR description. Do not modify this file otherwise. (lib/export.ts)