0
Fork 0
mirror of https://github.com/TanStack/router.git synced 2026-11-16 19:38:07 +00:00
router/packages/router-plugin/tests
Kyle Mathews 988a9d6788
test: add invariant and property tests for code-splitter shared bindings (#6662)
* test: add invariant, property, and exhaustive tests for code-splitter shared bindings

Add 76 new tests across three layers for the shared virtual module
code-splitting logic introduced in #6659:

Layer 1 - Algebraic property tests on helper functions:
- expandTransitively: idempotence, monotonicity, cycle handling
- buildDependencyGraph: subset invariants
- removeBindingsDependingOnRoute: direct/transitive removal
- expandDestructuredDeclarations: idempotence, sibling expansion
- collectLocalBindingsFromStatement: all declaration types

Layer 2 - Invariant tests on computeSharedBindings:
- Route is never in the shared set
- Results are always real local bindings (never imports)
- Destructured siblings cohesion
- Transitive dependency inclusion
- Route-dependent binding exclusion
- Determinism across repeated calls

Layer 3 - Small-scope exhaustive tests:
- Single binding × 3 declaration kinds × 4 property patterns × 2 groupings
- Two bindings × 4 cross-group reference patterns × 2 groupings
- Transitive dependency chains (linear, 3-deep, diamond)
- Meta-invariant conformance across all shared-* fixture files

Testing approach inspired by:
https://gist.github.com/KyleAMathews/64bcea53a57f600cc3b73bc366d9ac4d

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

* ci: apply automated fixes

---------

Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
History 2026-02-14 18:41:23 +01:00
..
add-hmr refactor(router-core): index routes have index nodes in the segment tree (#6171) 2025-12-21 16:32:19 +01:00
code-splitter fix: shared virtual module for code-split routes (#6659) 2026-02-14 13:10:54 +01:00
config/withJson fix(router-plugin): do not overwrite resolved generator config with unprocessed inline config (#5963) 2025-11-25 20:08:37 +02:00
delete-nodes fix: only transform files in codesplitter if changes were made (#5460) 2025-10-13 01:32:01 +02:00
add-hmr.test.ts fix: only transform files in codesplitter if changes were made (#5460) 2025-10-13 01:32:01 +02:00
code-splitter.test.ts test: add invariant and property tests for code-splitter shared bindings (#6662) 2026-02-14 18:41:23 +01:00
config.test.ts fix(router-plugin): do not overwrite resolved generator config with unprocessed inline config (#5963) 2025-11-25 20:08:37 +02:00
constants.ts feat: ssr setting per route (#4565) 2025-07-05 14:35:14 +02:00
delete-nodes.test.ts fix: only transform files in codesplitter if changes were made (#5460) 2025-10-13 01:32:01 +02:00
detect-route-codesplit-groupings.test.ts fix(router-plugin): codeSplittingOptions.splitBehavior to work with verboseFileRoutes (#4414) 2025-06-13 22:00:03 +12:00
shared-bindings-helpers.test.ts fix: shared virtual module for code-split routes (#6659) 2026-02-14 13:10:54 +01:00
utils.test.ts fix(router-plugin): normalize file paths for Windows compatibility with rspack/webpack (#6333) 2026-01-09 20:13:07 +13:00