Skip to content

test(query-core): assert exact booleans with 'toBe' instead of 'toBeTruthy'/'toBeFalsy' - #11043

Merged
sukvvon merged 1 commit into
mainfrom
test/query-core-boolean-assertions
Jul 11, 2026
Merged

test(query-core): assert exact booleans with 'toBe' instead of 'toBeTruthy'/'toBeFalsy'#11043
sukvvon merged 1 commit into
mainfrom
test/query-core-boolean-assertions

Conversation

@sukvvon

@sukvvonsukvvon commented Jul 11, 2026

Copy link
Copy Markdown
Member

🎯 Changes

Several assertions on strictly-typed boolean values used the loose toBeTruthy()/toBeFalsy() matchers. Since these values are guaranteed to be boolean by their type signatures, this tightens them to toBe(true)/toBe(false), which additionally catches a value being a truthy/falsy non-boolean (e.g. 1, '', an object) instead of a real boolean.

Affected assertions (all return/field types are boolean):

  • onlineManager.isOnline()isOnline(): boolean (3)
  • focusManager.isFocused()isFocused(): boolean (2)
  • isPlainObject() / matchMutation()boolean return (5)
  • query.state.isInvalidatedisInvalidated: boolean (1)
  • observer getCurrentResult().isPausedisPaused: boolean (12)

✅ Checklist

🚀 Release Impact

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

Summary by CodeRabbit

  • Tests
    • Tightened boolean assertions across focus, online status, query invalidation, paused mutations, and utility behavior tests.
    • Improved test precision by requiring exact true or false results instead of truthy or falsy values.

@sukvvonsukvvon self-assigned this Jul 11, 2026
@nx-cloud

nx-cloudBot commented Jul 11, 2026

Copy link
Copy Markdown

View your CI Pipeline Execution ↗ for commit c41a9a4

CommandStatusDurationResult
nx affected --targets=test:sherif,test:knip,tes...✅ Succeeded3m 23sView ↗

☁️ Nx Cloud last updated this comment at 2026-07-11 02:39:07 UTC

@coderabbitai

coderabbitaiBot commented Jul 11, 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

Run ID: 4180515d-dc13-4c82-87b3-4f01f8560f52

📥 Commits

Reviewing files that changed from the base of the PR and between 64241b8 and c41a9a4.

📒 Files selected for processing (5)
  • packages/query-core/src/__tests__/focusManager.test.tsx
  • packages/query-core/src/__tests__/onlineManager.test.tsx
  • packages/query-core/src/__tests__/query.test.tsx
  • packages/query-core/src/__tests__/queryClient.test.tsx
  • packages/query-core/src/__tests__/utils.test.tsx

📝 Walkthrough

Walkthrough

Changes

Boolean assertion tightening

Layer / File(s)Summary
Focus and online state assertions
packages/query-core/src/__tests__/focusManager.test.tsx, packages/query-core/src/__tests__/onlineManager.test.tsx
Focus and online manager tests now require exact boolean results.
Query and mutation state assertions
packages/query-core/src/__tests__/query.test.tsx, packages/query-core/src/__tests__/queryClient.test.tsx
Invalidation and paused-mutation tests now require exact true state values.
Utility predicate assertions
packages/query-core/src/__tests__/utils.test.tsx
isPlainObject and matchMutation tests now use explicit boolean expectations.

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

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check nameStatusExplanation
Title check✅ PassedThe title clearly and concisely summarizes the main change: tightening boolean assertions in query-core tests.
Description check✅ PassedThe description follows the template and includes the changes, checklist, and release impact sections with relevant details.
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.
✨ 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/query-core-boolean-assertions

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

@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.

@pkg-pr-new

Copy link
Copy Markdown
More templates

@tanstack/angular-query-experimental

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

@tanstack/eslint-plugin-query

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

@tanstack/lit-query

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

@tanstack/preact-query

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

@tanstack/preact-query-devtools

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

@tanstack/preact-query-persist-client

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

@tanstack/query-async-storage-persister

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

@tanstack/query-broadcast-client-experimental

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

@tanstack/query-core

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

@tanstack/query-devtools

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

@tanstack/query-persist-client-core

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

@tanstack/query-sync-storage-persister

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

@tanstack/react-query

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

@tanstack/react-query-devtools

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

@tanstack/react-query-next-experimental

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

@tanstack/react-query-persist-client

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

@tanstack/solid-query

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

@tanstack/solid-query-devtools

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

@tanstack/solid-query-persist-client

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

@tanstack/svelte-query

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

@tanstack/svelte-query-devtools

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

@tanstack/svelte-query-persist-client

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

@tanstack/vue-query

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

@tanstack/vue-query-devtools

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

commit: c41a9a4

@github-actions

Copy link
Copy Markdown
Contributor

size-limit report 📦

PathSize
react full12.13 KB (0%)
react minimal9.08 KB (0%)

@sukvvon
sukvvon merged commit dea3698 into mainJul 11, 2026
11 of 12 checks passed
@sukvvon
sukvvon deleted the test/query-core-boolean-assertions branch July 11, 2026 02:43
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