Skip to content

test(solid-query): replace hardcoded query keys with 'queryKey()' utility#10416

Merged
sukvvon merged 1 commit intomainfrom
test/solid-query-replace-hardcoded-keys-with-queryKey
Apr 7, 2026
Merged

test(solid-query): replace hardcoded query keys with 'queryKey()' utility#10416
sukvvon merged 1 commit intomainfrom
test/solid-query-replace-hardcoded-keys-with-queryKey

Conversation

@sukvvon
Copy link
Copy Markdown
Collaborator

@sukvvon sukvvon commented Apr 7, 2026

🎯 Changes

  • Replace hardcoded query/mutation keys with queryKey() utility from @tanstack/query-test-utils across solid-query test files
  • Applied to runtime tests (.test.tsx) and type tests (.test-d.tsx)
  • Files modified: useQuery.test.tsx, useQuery.test-d.tsx, useMutationState.test.tsx, useIsMutating.test.tsx, mutationOptions.test.tsx, mutationOptions.test-d.tsx, queryOptions.test-d.tsx, infiniteQueryOptions.test-d.tsx, createQueries.test-d.tsx

✅ Checklist

  • I have followed the steps in the Contributing guide.
  • I have tested this code locally with pnpm run test:pr.

🚀 Release Impact

  • This change affects published code, and I have generated a changeset.
  • This change is docs/CI/dev-only (no release).

Summary by CodeRabbit

  • Tests
    • Standardized test key generation across mutation and query test suites to improve consistency and type-checking validation throughout the test infrastructure.

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai bot commented Apr 7, 2026

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 75606ea2-95c8-41a8-a4ab-a4e3e2ba9697

📥 Commits

Reviewing files that changed from the base of the PR and between e203306 and 05f789f.

📒 Files selected for processing (9)
  • packages/solid-query/src/__tests__/createQueries.test-d.tsx
  • packages/solid-query/src/__tests__/infiniteQueryOptions.test-d.tsx
  • packages/solid-query/src/__tests__/mutationOptions.test-d.tsx
  • packages/solid-query/src/__tests__/mutationOptions.test.tsx
  • packages/solid-query/src/__tests__/queryOptions.test-d.tsx
  • packages/solid-query/src/__tests__/useIsMutating.test.tsx
  • packages/solid-query/src/__tests__/useMutationState.test.tsx
  • packages/solid-query/src/__tests__/useQuery.test-d.tsx
  • packages/solid-query/src/__tests__/useQuery.test.tsx

📝 Walkthrough

Walkthrough

Multiple TypeScript and runtime test files in packages/solid-query/src/__tests__/ were updated to replace hardcoded query and mutation key array literals with a queryKey() helper function imported from @tanstack/query-test-utils, ensuring consistent and dynamically generated test keys across test suites.

Changes

Cohort / File(s) Summary
Query & Infinite Query Type-Level Tests
createQueries.test-d.tsx, infiniteQueryOptions.test-d.tsx, queryOptions.test-d.tsx, useQuery.test-d.tsx
Replaced hardcoded queryKey: ['key'] literals with queryKey() helper invocations, updating type assertions and downstream usages in type-level test cases.
Mutation Type-Level & Runtime Tests
mutationOptions.test-d.tsx, mutationOptions.test.tsx, useIsMutating.test.tsx, useMutationState.test.tsx
Replaced hardcoded mutationKey array literals (e.g., ['key'], ['mutation']) with queryKey() helper, threading the generated keys into useMutation options and filter predicates throughout test cases.
Query Hook Runtime Test
useQuery.test.tsx
Updated query key from static ['key'] literal to dynamically generated queryKey() value in a state-transition test case for enabled-flag refetching.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~15 minutes

Possibly related PRs

Poem

🐰 Keys once carved in stone, now dance and play,
Generated fresh with each test's way,
No more hardcoded strings in sight,
Our queries leap and mutations take flight! ✨

🚥 Pre-merge checks | ✅ 2 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (2 passed)
Check name Status Explanation
Title check ✅ Passed The title accurately describes the main change: replacing hardcoded query keys with the queryKey() utility across solid-query test files.
Description check ✅ Passed The description follows the template structure and provides clear details about the changes, files modified, and checklist status. One test item is unchecked but this doesn't significantly impact the quality.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch test/solid-query-replace-hardcoded-keys-with-queryKey

Comment @coderabbitai help to get the list of available commands and usage tips.

@nx-cloud
Copy link
Copy Markdown

nx-cloud bot commented Apr 7, 2026

View your CI Pipeline Execution ↗ for commit 05f789f

Command Status Duration Result
nx affected --targets=test:sherif,test:knip,tes... ✅ Succeeded 2m 38s View ↗
nx run-many --target=build --exclude=examples/*... ✅ Succeeded <1s View ↗

☁️ Nx Cloud last updated this comment at 2026-04-07 02:20:05 UTC

@github-actions
Copy link
Copy Markdown
Contributor

github-actions bot commented Apr 7, 2026

🚀 Changeset Version Preview

No changeset entries found. Merging this PR will not cause a version bump for any packages.

@pkg-pr-new
Copy link
Copy Markdown

pkg-pr-new bot commented Apr 7, 2026

More templates

@tanstack/angular-query-experimental

npm i https://pkg.pr.new/@tanstack/angular-query-experimental@10416

@tanstack/eslint-plugin-query

npm i https://pkg.pr.new/@tanstack/eslint-plugin-query@10416

@tanstack/preact-query

npm i https://pkg.pr.new/@tanstack/preact-query@10416

@tanstack/preact-query-devtools

npm i https://pkg.pr.new/@tanstack/preact-query-devtools@10416

@tanstack/preact-query-persist-client

npm i https://pkg.pr.new/@tanstack/preact-query-persist-client@10416

@tanstack/query-async-storage-persister

npm i https://pkg.pr.new/@tanstack/query-async-storage-persister@10416

@tanstack/query-broadcast-client-experimental

npm i https://pkg.pr.new/@tanstack/query-broadcast-client-experimental@10416

@tanstack/query-core

npm i https://pkg.pr.new/@tanstack/query-core@10416

@tanstack/query-devtools

npm i https://pkg.pr.new/@tanstack/query-devtools@10416

@tanstack/query-persist-client-core

npm i https://pkg.pr.new/@tanstack/query-persist-client-core@10416

@tanstack/query-sync-storage-persister

npm i https://pkg.pr.new/@tanstack/query-sync-storage-persister@10416

@tanstack/react-query

npm i https://pkg.pr.new/@tanstack/react-query@10416

@tanstack/react-query-devtools

npm i https://pkg.pr.new/@tanstack/react-query-devtools@10416

@tanstack/react-query-next-experimental

npm i https://pkg.pr.new/@tanstack/react-query-next-experimental@10416

@tanstack/react-query-persist-client

npm i https://pkg.pr.new/@tanstack/react-query-persist-client@10416

@tanstack/solid-query

npm i https://pkg.pr.new/@tanstack/solid-query@10416

@tanstack/solid-query-devtools

npm i https://pkg.pr.new/@tanstack/solid-query-devtools@10416

@tanstack/solid-query-persist-client

npm i https://pkg.pr.new/@tanstack/solid-query-persist-client@10416

@tanstack/svelte-query

npm i https://pkg.pr.new/@tanstack/svelte-query@10416

@tanstack/svelte-query-devtools

npm i https://pkg.pr.new/@tanstack/svelte-query-devtools@10416

@tanstack/svelte-query-persist-client

npm i https://pkg.pr.new/@tanstack/svelte-query-persist-client@10416

@tanstack/vue-query

npm i https://pkg.pr.new/@tanstack/vue-query@10416

@tanstack/vue-query-devtools

npm i https://pkg.pr.new/@tanstack/vue-query-devtools@10416

commit: 05f789f

@github-actions
Copy link
Copy Markdown
Contributor

github-actions bot commented Apr 7, 2026

size-limit report 📦

Path Size
react full 11.98 KB (0%)
react minimal 9.01 KB (0%)

@sukvvon sukvvon self-assigned this Apr 7, 2026
@sukvvon sukvvon merged commit d9384ac into main Apr 7, 2026
10 checks passed
@sukvvon sukvvon deleted the test/solid-query-replace-hardcoded-keys-with-queryKey branch April 7, 2026 02:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant