[PR #32340] test(web): strengthen nuqs testing infrastructure and documentation #33681

Closed
opened 2026-02-21 20:53:42 -05:00 by yindo · 0 comments
Owner

Original Pull Request: https://github.com/langgenius/dify/pull/32340

State: closed
Merged: Yes


Problem

nuqs hooks require an adapter in tests, but our test setup was inconsistent: many specs used ad-hoc wrappers, URL sync assertions were uneven, and docs/skill guidance did not fully encode the same testing model.

Decision

Standardize nuqs testing around one shared helper and align project guidance with that approach.

Model

  • Add web/test/nuqs-testing.tsx as the canonical test utility:
    • createNuqsTestWrapper
    • renderWithNuqs
    • renderHookWithNuqs (including initialProps support)
  • Migrate existing test suites from direct NuqsTestingAdapter usage to shared helpers (apps, datasets, explore, marketplace, tools, context, hooks).
  • Update web/docs/test.md and frontend-testing skill references to require adapter-based URL-state testing and onUrlUpdate assertions.

Impact

  • Removes duplicated wrapper code and prevents adapter-missing failures.
  • Makes URL-state tests more consistent and easier to maintain.
  • Keeps docs/skills aligned with actual test infrastructure, so future tests follow one predictable pattern.

Validation

  • cd web && pnpm type-check:tsgo
  • Targeted Vitest suites for migrated files all pass.
**Original Pull Request:** https://github.com/langgenius/dify/pull/32340 **State:** closed **Merged:** Yes --- ## Problem `nuqs` hooks require an adapter in tests, but our test setup was inconsistent: many specs used ad-hoc wrappers, URL sync assertions were uneven, and docs/skill guidance did not fully encode the same testing model. ## Decision Standardize `nuqs` testing around one shared helper and align project guidance with that approach. ## Model - Add `web/test/nuqs-testing.tsx` as the canonical test utility: - `createNuqsTestWrapper` - `renderWithNuqs` - `renderHookWithNuqs` (including `initialProps` support) - Migrate existing test suites from direct `NuqsTestingAdapter` usage to shared helpers (apps, datasets, explore, marketplace, tools, context, hooks). - Update `web/docs/test.md` and `frontend-testing` skill references to require adapter-based URL-state testing and `onUrlUpdate` assertions. ## Impact - Removes duplicated wrapper code and prevents adapter-missing failures. - Makes URL-state tests more consistent and easier to maintain. - Keeps docs/skills aligned with actual test infrastructure, so future tests follow one predictable pattern. ## Validation - `cd web && pnpm type-check:tsgo` - Targeted Vitest suites for migrated files all pass.
yindo added the pull-request label 2026-02-21 20:53:42 -05:00
yindo closed this issue 2026-02-21 20:53:42 -05:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: langgenius/dify#33681