Skip to content

test(lit-query): replace 'toBeDefined'/'toBeGreaterThan' with exact-value assertions - #11122

Merged
sukvvon merged 1 commit into
mainfrom
test/lit-query-exact-assertions
Jul 26, 2026
Merged

test(lit-query): replace 'toBeDefined'/'toBeGreaterThan' with exact-value assertions#11122
sukvvon merged 1 commit into
mainfrom
test/lit-query-exact-assertions

Conversation

@sukvvon

@sukvvonsukvvon commented Jul 26, 2026

Copy link
Copy Markdown
Member

🎯 Changes

Continues the recent test-quality series (e.g. #11105, #11093) by converting the toBeDefined() / toBeFalsy() assertions in lit-query tests to exact assertions:

  • counters-and-state.test.ts — cache presence check now asserts the exact cached value (?.state.data) produced by the test's queryFn.
  • infinite-and-options.test.ts — cache presence check now asserts the exact cached pages/pageParams shape.
  • queries-controller.test.ts — cache presence check now asserts the exact cached value for the first query key.
  • query-controller.test.ts — three cases strengthened: an existence check now asserts ?.state.data against the resolved array, and two data/call-count checks now assert exact literals instead of toBeDefined() / toBeGreaterThan(0).

Each strengthening is guarded by a preceding waitFor(... isSuccess) (or equivalent) that guarantees the fetch has settled at the assertion point.

✅ Checklist

Local verification detail: vitest run on the four edited files — 102 tests passed, no type errors.

🚀 Release Impact

  • This change is docs/CI/dev-only (no release).

Summary by CodeRabbit

  • Tests
    • Strengthened query and infinite-query tests to verify exact cached data values.
    • Added precise checks for query results and execution counts during reconnects and provider resolution.
    • Improved coverage for explicit client precedence and provider-backed query behavior.

@nx-cloud

nx-cloudBot commented Jul 26, 2026

Copy link
Copy Markdown

View your CI Pipeline Execution ↗ for commit 99a78c6

CommandStatusDurationResult
nx affected --targets=test:sherif,test:knip,tes...✅ Succeeded3m 27sView ↗
nx run-many --target=build --exclude=examples/*...✅ Succeeded12sView ↗

☁️ Nx Cloud last updated this comment at 2026-07-26 15:51:55 UTC

@github-actions

Copy link
Copy Markdown
Contributor

🚀 Changeset Version Preview

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

@coderabbitai

coderabbitaiBot commented Jul 26, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

📝 Walkthrough

Walkthrough

Changes

Lit Query test assertions

Layer / File(s)Summary
Client precedence cache data assertions
packages/lit-query/src/tests/counters-and-state.test.ts, packages/lit-query/src/tests/infinite-and-options.test.ts, packages/lit-query/src/tests/queries-controller.test.ts
Explicit-client precedence tests now verify exact cached query data for standard, infinite, and multi-query controllers.
Query controller result assertions
packages/lit-query/src/tests/query-controller.test.ts
Query controller tests now verify cached results, returned data, and exact query execution counts across reconnect and provider-resolution scenarios.

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

Suggested reviewers:chughgaurav

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check nameStatusExplanation
Docstring Coverage✅ PassedNo functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check✅ PassedCheck skipped because no linked issues were found for this pull request.
Out of Scope Changes check✅ PassedCheck skipped because no linked issues were found for this pull request.
Title check✅ PassedThe title clearly summarizes the main change: tightening lit-query tests to exact-value assertions.
Description check✅ PassedThe description follows the required template and covers changes, checklist, testing, and release impact.
✨ 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/lit-query-exact-assertions

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

@sukvvonsukvvon changed the title test(lit-query): assert exact values instead of loose matcherstest(lit-query): replace 'toBeDefined()'/'toBeGreaterThan()' with exact-value assertionsJul 26, 2026
@pkg-pr-new

Copy link
Copy Markdown
More templates

@tanstack/angular-query-experimental

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

@tanstack/eslint-plugin-query

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

@tanstack/lit-query

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

@tanstack/preact-query

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

@tanstack/preact-query-devtools

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

@tanstack/preact-query-persist-client

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

@tanstack/query-async-storage-persister

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

@tanstack/query-broadcast-client-experimental

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

@tanstack/query-core

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

@tanstack/query-devtools

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

@tanstack/query-persist-client-core

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

@tanstack/query-sync-storage-persister

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

@tanstack/react-query

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

@tanstack/react-query-devtools

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

@tanstack/react-query-next-experimental

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

@tanstack/react-query-persist-client

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

@tanstack/solid-query

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

@tanstack/solid-query-devtools

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

@tanstack/solid-query-persist-client

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

@tanstack/svelte-query

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

@tanstack/svelte-query-devtools

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

@tanstack/svelte-query-persist-client

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

@tanstack/vue-query

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

@tanstack/vue-query-devtools

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

commit: 99a78c6

@sukvvonsukvvon changed the title test(lit-query): replace 'toBeDefined()'/'toBeGreaterThan()' with exact-value assertionstest(lit-query): replace 'toBeDefined'/'toBeGreaterThan' with exact-value assertionsJul 26, 2026
@github-actions

Copy link
Copy Markdown
Contributor

size-limit report 📦

PathSize
react full12.15 KB (0%)
react minimal9.1 KB (0%)

@sukvvonsukvvon self-assigned this Jul 26, 2026
@sukvvon
sukvvon merged commit f99c105 into mainJul 26, 2026
9 checks passed
@sukvvon
sukvvon deleted the test/lit-query-exact-assertions branch July 26, 2026 15:57
Sign up for freeto 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

@sukvvon