Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: add tests for usePrefetchQuery and usePrefetchInfiniteQuery #7586

Conversation

brunolopesr
Copy link
Contributor

This PR adds tests to #7582

Copy link

vercel bot commented Jun 18, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

1 Ignored Deployment
Name Status Preview Comments Updated (UTC)
query ⬜️ Ignored (Inspect) Visit Preview Jun 18, 2024 10:06pm

Copy link

codesandbox-ci bot commented Jun 18, 2024

This pull request is automatically built and testable in CodeSandbox.

To see build info of the built libraries, click here or the icon next to each commit SHA.

Latest deployment of this branch, based on commit 0c335a2:

Sandbox Source
@tanstack/query-example-angular-basic Configuration
@tanstack/query-example-react-basic-typescript Configuration
@tanstack/query-example-solid-basic-typescript Configuration
@tanstack/query-example-svelte-basic Configuration
@tanstack/query-example-vue-basic Configuration

Copy link
Collaborator

@TkDodo TkDodo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

great work 🚀

Copy link

nx-cloud bot commented Jun 18, 2024

☁️ Nx Cloud Report

CI is running/has finished running commands for commit 0c335a2. As they complete they will appear below. Click to see the status, the terminal output, and the build insights.

📂 See all runs for this CI Pipeline Execution


✅ Successfully ran 1 target

Sent with 💌 from NxCloud.

Copy link

codecov bot commented Jun 18, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 87.30%. Comparing base (5bda18f) to head (0c335a2).

Additional details and impacted files

Impacted file tree graph

@@                      Coverage Diff                       @@
##           feature/use-prefetch-query    #7586      +/-   ##
==============================================================
+ Coverage                       83.49%   87.30%   +3.80%     
==============================================================
  Files                              24       24              
  Lines                             315      315              
  Branches                           80       79       -1     
==============================================================
+ Hits                              263      275      +12     
+ Misses                             43       33      -10     
+ Partials                            9        7       -2     
Components Coverage Δ
@tanstack/angular-query-devtools-experimental ∅ <ø> (∅)
@tanstack/angular-query-experimental ∅ <ø> (∅)
@tanstack/eslint-plugin-query ∅ <ø> (∅)
@tanstack/query-async-storage-persister ∅ <ø> (∅)
@tanstack/query-broadcast-client-experimental ∅ <ø> (∅)
@tanstack/query-codemods ∅ <ø> (∅)
@tanstack/query-core ∅ <ø> (∅)
@tanstack/query-devtools ∅ <ø> (∅)
@tanstack/query-persist-client-core ∅ <ø> (∅)
@tanstack/query-sync-storage-persister ∅ <ø> (∅)
@tanstack/react-query 94.42% <ø> (+4.46%) ⬆️
@tanstack/react-query-devtools 10.71% <ø> (ø)
@tanstack/react-query-next-experimental ∅ <ø> (∅)
@tanstack/react-query-persist-client 100.00% <ø> (ø)
@tanstack/solid-query ∅ <ø> (∅)
@tanstack/solid-query-devtools ∅ <ø> (∅)
@tanstack/solid-query-persist-client ∅ <ø> (∅)
@tanstack/svelte-query ∅ <ø> (∅)
@tanstack/svelte-query-devtools ∅ <ø> (∅)
@tanstack/svelte-query-persist-client ∅ <ø> (∅)
@tanstack/vue-query ∅ <ø> (∅)
@tanstack/vue-query-devtools ∅ <ø> (∅)

@brunolopesr brunolopesr force-pushed the feature/use-prefetch-query-tests branch from 1ff0b04 to ea58e80 Compare June 18, 2024 10:05
@brunolopesr brunolopesr requested a review from TkDodo June 18, 2024 16:22
@TkDodo TkDodo merged commit 0cc8a26 into TanStack:feature/use-prefetch-query Jun 19, 2024
8 checks passed
@brunolopesr brunolopesr deleted the feature/use-prefetch-query-tests branch June 24, 2024 15:33
TkDodo added a commit that referenced this pull request Jun 25, 2024
* feat: usePrefetchQuery

* refactor: switch to actual prefetching

* refactor: remove ensureInfiniteQueryData function

will do in a separate PR

* chore: add tests for usePrefetchQuery and usePrefetchInfiniteQuery (#7586)

* chore: add tests for usePrefetchQuery and usePrefetchInfiniteQuery

* chore: update tests to assert the alternative spy is not called

* chore: add some new tests

* chore: remove it.only whoops

* chore: call mockClear after fetching

* chore: improve waterfall test by asserting fallback calls instead of loading node query

* chore: improve code repetition

* chore: add some generics to helper functions

* usePrefetchQuery type tests and docs (#7592)

* chore: add type tests and docs

* chore: update hooks to use FetchQueryOptions and FetchInfiniteQueryOptions

* chore: update tests

* chore: update docs

* chore: remove .md extension from link

* chore: add unknown default value to TQueryFnData

* Apply suggestions from code review

---------

Co-authored-by: Dominik Dorfmeister <office@dorfmeister.cc>

* Apply suggestions from code review

Co-authored-by: Fredrik Höglund <fredrik.hoglund@gmail.com>

* chore: fix types in tests

* chore: add new tests (#7614)

* chore: add new tests

* Apply suggestions from code review

---------

Co-authored-by: Dominik Dorfmeister <office@dorfmeister.cc>

---------

Co-authored-by: Bruno Lopes <88719327+brunolopesr@users.noreply.github.com>
Co-authored-by: Fredrik Höglund <fredrik.hoglund@gmail.com>
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.

2 participants