test: add integration suite covering cross-module compositions#12
Merged
test: add integration suite covering cross-module compositions#12
Conversation
Populate packages/plainfp/src/__tests__/ with cross-module integration tests. Unit + property tests cover the primitives; these tests verify that realistic user-facing compositions actually work end to end. Six scenarios, each in its own *.int.test.ts file: - parse-validate-transform — the canonical fromZod → Result.flatMap → Result.map → match pipeline, with parse, business, and domain errors short-circuiting at the right layer. - batch-fetch — Arrays.map over ids into ResultAsync.fromPromise calls, collected by ResultAsync.all; plus allWithConcurrency with realistic staggered latencies to verify the concurrency cap holds. - retry-timeout-fetch — a realistic fetch client composed from fromPromise + retry + timeout + map + mapError. Covers recovery from transient failures, giving up after N attempts, and timeout races. - option-result-interop — the lookup → toResult → validate → getOr flow that lets Option and Result coexist cleanly. Round-trip semantics (toOption ∘ toResult preserves some values, discards errors on none) are locked in. - data-pipeline — the README's headline Arrays.groupBy → Records.mapValues → Arrays.sumBy example, plus countBy-by-status, uniqueBy dedup, and empty-input robustness. - tagged-errors — Tagged.tag + hasTag composed with Result + mapError + match for exhaustive discriminated error handling. 27 new test cases, 276 total passing. No runtime code touched. These files live under src/__tests__/ as originally planned in the project scope; individual unit tests continue to be colocated beside the module they test.
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #12 +/- ##
==========================================
+ Coverage 89.16% 91.68% +2.51%
==========================================
Files 23 23
Lines 397 397
Branches 90 90
==========================================
+ Hits 354 364 +10
+ Misses 13 11 -2
+ Partials 30 22 -8
Flags with carried forward coverage won't be shown. Click here to find out more. 🚀 New features to boost your workflow:
|
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
Populate `packages/plainfp/src/tests/` with the integration suite that the project scope originally planned. Unit + property tests already verify each primitive in isolation; this suite exercises realistic user-facing compositions end to end.
Scenarios
Six files, each stands alone as a readable example of a common usage pattern.
Why integration tests
Unit tests structurally can't catch:
Each scenario is taken straight from the README or the CONTRIBUTING examples, so these tests also serve as executable documentation.
Results
Scope doc alignment
Original scope:
`tests/` was created but never populated. This PR fills it.
Test plan