Skip to content

test(svelte-query/createQuery): replace 'toBeDefined' with exact-value assertion - #11126

Open
aken-you wants to merge 2 commits into
TanStack:mainfrom
aken-you:test/svelte-query-replace-toBeDefined
Open

test(svelte-query/createQuery): replace 'toBeDefined' with exact-value assertion#11126
aken-you wants to merge 2 commits into
TanStack:mainfrom
aken-you:test/svelte-query-replace-toBeDefined

Conversation

@aken-you

@aken-you aken-you commented Jul 27, 2026

Copy link
Copy Markdown

🎯 Changes

Continues the recent test-quality series (e.g. #11105, #11093, #11124) by converting the toBeDefined() assertion in svelte-query tests to an exact assertion:

  • createQuery.svelte.test.ts — the cache presence checks now assert the exact queryKey (?.queryKey) registered in each client's cache, confirming that the query is correctly re-registered under the new client after the reactive swap from queryClient1 to queryClient2.

✅ 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
    • Strengthened coverage for switching query clients by verifying that cached entries retain the expected query key for both the initial and updated clients.

@coderabbitai

coderabbitai Bot commented Jul 27, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: aed3530a-15ef-4c43-8326-6a1772f68cde

📥 Commits

Reviewing files that changed from the base of the PR and between d279a2a and c6652bc.

📒 Files selected for processing (1)
  • packages/svelte-query/tests/createQuery/createQuery.svelte.test.ts
🚧 Files skipped from review as they are similar to previous changes (1)
  • packages/svelte-query/tests/createQuery/createQuery.svelte.test.ts

📝 Walkthrough

Walkthrough

The query client switching test now verifies that cached entries retain the expected queryKey for both the initial and updated QueryClient.

Changes

Query client cache validation

Layer / File(s) Summary
Validate cached query keys
packages/svelte-query/tests/createQuery/createQuery.svelte.test.ts
The test compares cached query entries’ queryKey values with the expected key for both query clients instead of only checking that entries are defined.

Estimated code review effort: 1 (Trivial) | ~2 minutes

Possibly related PRs

Suggested reviewers: sukvvon

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly describes the primary test assertion change in svelte-query/createQuery.
Description check ✅ Passed The description follows the template with Changes, Checklist, and Release Impact sections filled in.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

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

@nx-cloud

nx-cloud Bot commented Jul 27, 2026

Copy link
Copy Markdown

View your CI Pipeline Execution ↗ for commit d279a2a

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

☁️ Nx Cloud last updated this comment at 2026-07-27 08:18:01 UTC

@pkg-pr-new

pkg-pr-new Bot commented Jul 27, 2026

Copy link
Copy Markdown
More templates

@tanstack/angular-query-experimental

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

@tanstack/eslint-plugin-query

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

@tanstack/lit-query

npm i https://pkg.pr.new/@tanstack/lit-query@11126

@tanstack/preact-query

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

@tanstack/preact-query-devtools

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

@tanstack/preact-query-persist-client

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

@tanstack/query-async-storage-persister

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

@tanstack/query-broadcast-client-experimental

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

@tanstack/query-core

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

@tanstack/query-devtools

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

@tanstack/query-persist-client-core

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

@tanstack/query-sync-storage-persister

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

@tanstack/react-query

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

@tanstack/react-query-devtools

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

@tanstack/react-query-next-experimental

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

@tanstack/react-query-persist-client

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

@tanstack/solid-query

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

@tanstack/solid-query-devtools

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

@tanstack/solid-query-persist-client

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

@tanstack/svelte-query

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

@tanstack/svelte-query-devtools

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

@tanstack/svelte-query-persist-client

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

@tanstack/vue-query

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

@tanstack/vue-query-devtools

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

commit: c6652bc

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant