Repository navigation
test(csv-parser): add unit tests for parseCsvBatch, parseDuration and resolveCliffTime - #627
Merged
Austinaminu2 merged 1 commit intoAug 25, 2026
Conversation
…d resolveCliffTime - Cover valid rows: multi-row parsing, optional columns (cliff_time, cliff_amount, cliff_duration), CRLF line endings, whitespace trimming, blank line filtering, extra columns, header-only CSV - Cover invalid rows: missing required columns (recipient, amount, start_time, end_time), zero rows returned on validation error - Cover malformed CSV: unclosed quoted field, row too short, all-empty fields (just commas), blank lines after header, unrecognised headers treated as data rows, quoted field with literal backslash-n text - Cover header aliases: address, total_amount, start_date / end_date, cliff_period, and custom column mapping - Cover parseDuration: plain seconds, all unit suffixes (s/m/h/d/w), case-insensitive + whitespace tolerance, null for unparseable values - Cover resolveCliffTime: absolute cliff_time, relative cliff_duration, priority of cliff_time over cliff_duration, null start_time guard, unparseable inputs, and end-to-end round-trip through parseCsvBatch Closes FlowwStar#499
brightfootlimited-collab
had a problem deploying
to
staging
August 25, 2026 21:33 — with
GitHub Actions
Failure
This branch had an error being deployed
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.
Summary
Closes #499
Adds comprehensive unit tests for
lib/csv-parser.ts, covering all three exported functions across three input categories.What was tested
Valid rows
address,total_amount,start_date,end_date,cliff_period)cliff_time,cliff_amount,cliff_durationInvalid rows
recipient,amount,start_time/start_date,end_time/end_dateMalformed CSV input
""""""\ntext → parsed without crashingparseDuration
s,m,h,d,w)nullfor empty, non-numeric, float, negative, and unknown-suffix inputsresolveCliffTime
cliff_time, relativecliff_duration(duration suffixes + plain seconds)cliff_timewins overcliff_durationwhen both presentnullwhenstartTimeisnull(duration path)nullfor unparseablecliff_time/cliff_durationparseCsvBatchthen cliff resolved byresolveCliffTimeTesting
Tests use Vitest + jsdom (existing project setup). No new dependencies added.