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

test(client): fully cover client module #2295

Merged
merged 14 commits into from
Aug 26, 2021
Merged

test(client): fully cover client module #2295

merged 14 commits into from
Aug 26, 2021

Conversation

ubbe-xyz
Copy link
Collaborator

@ubbe-xyz ubbe-xyz commented Jul 1, 2021

Reasoning πŸ’‘

Screenshot 2021-07-16 at 21 12 40

Final tests for <SessionProvider /> and useSession() πŸ‹πŸ»β€β™€οΈ

Checklist 🧒

  • Documentation
  • Tests
  • Ready to be merged

Affected issues 🎟

None

@ubbe-xyz ubbe-xyz added the test Related to testing label Jul 1, 2021
@vercel
Copy link

vercel bot commented Jul 1, 2021

This pull request is being automatically deployed with Vercel (learn more).
To see the status of your deployment, click below or on the icon next to each commit.

πŸ” Inspect: https://vercel.com/nextauthjs/next-auth/CJmTp4yDwjdj7KQTqzL3xFmSumvD
βœ… Preview: https://next-auth-git-test-client-tests-nextauthjs.vercel.app

@ubbe-xyz ubbe-xyz changed the base branch from main to next July 1, 2021 17:31
@github-actions github-actions bot added client Client related code core Refers to `@auth/core` and removed test Related to testing labels Jul 1, 2021
@vercel vercel bot temporarily deployed to Preview July 11, 2021 16:49 Inactive
Copy link
Member

@ndom91 ndom91 left a comment

Choose a reason for hiding this comment

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

LGTM πŸ‘

I didn't follow the thread 100%, on mobile currently, but I saw your TODO, just curious why can't we clean __NEXTAUTH between test runs?

@vercel vercel bot temporarily deployed to Preview July 16, 2021 19:13 Inactive
@balazsorban44
Copy link
Member

balazsorban44 commented Jul 16, 2021

Small comment I noticed that dist/client/__tests__ are also getting in the package published to npm. we should have a look.

don't see why those are generated from the .ts test files at all, they are just tests, if not possible to not generate them, should we just delete after a test run?

@vercel vercel bot temporarily deployed to Preview July 18, 2021 10:39 Inactive
@codecov-commenter
Copy link

codecov-commenter commented Jul 18, 2021

Codecov Report

Merging #2295 (5f2e4ac) into next (eb8ba69) will increase coverage by 2.49%.
The diff coverage is 100.00%.

Impacted file tree graph

@@            Coverage Diff             @@
##             next    #2295      +/-   ##
==========================================
+ Coverage   11.48%   13.97%   +2.49%     
==========================================
  Files          85       85              
  Lines        1324     1324              
  Branches      379      378       -1     
==========================================
+ Hits          152      185      +33     
+ Misses        975      950      -25     
+ Partials      197      189       -8     
Impacted Files Coverage Ξ”
src/client/react.js 95.54% <100.00%> (+10.19%) ⬆️
src/lib/logger.js 65.78% <0.00%> (+44.73%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Ξ” = absolute <relative> (impact), ΓΈ = not affected, ? = missing data
Powered by Codecov. Last update eb8ba69...5f2e4ac. Read the comment docs.

@vercel vercel bot temporarily deployed to Preview July 18, 2021 10:47 Inactive
@balazsorban44 balazsorban44 added the priority Priority fix or enhancement label Aug 13, 2021
@balazsorban44 balazsorban44 changed the title Fully cover client module 🍜 fix(react): make staleTime work Aug 13, 2021
@vercel vercel bot temporarily deployed to Preview August 25, 2021 22:24 Inactive
@balazsorban44
Copy link
Member

@theobr has pointed out to me that staleTime might actually be unnecessary and have a huge overlap with the refetchInterval option. The only difference is that the former executes a session re-fetch once, while the latter does that periodically. It might make sense to remove staleTime altogether.

@lluia After reading the docs, would you agree?:
https://next-auth-git-next-nextauthjs.vercel.app/getting-started/client#stale-time
https://next-auth-git-next-nextauthjs.vercel.app/getting-started/client#refetch-interval

@ubbe-xyz
Copy link
Collaborator Author

ubbe-xyz commented Aug 26, 2021

@balazsorban44 thinking twice, you're right, refetchInterval comes with an implicit staleTime πŸ˜†

I believe most clients are looking for the behaviour offered by refetchInterval, so I think we could remove staleTime and just improve the docs of refetchInterval πŸ‘πŸ½

β€’ remove `staleTime`
β€’ finish client tests
@vercel vercel bot temporarily deployed to Preview August 26, 2021 09:54 Inactive
@ubbe-xyz ubbe-xyz marked this pull request as ready for review August 26, 2021 09:54
@vercel vercel bot temporarily deployed to Preview August 26, 2021 09:55 Inactive
@vercel vercel bot temporarily deployed to Preview August 26, 2021 11:06 Inactive
@vercel vercel bot temporarily deployed to Preview August 26, 2021 11:07 Inactive
@balazsorban44 balazsorban44 changed the title fix(react): make staleTime work feat(react): remove staleTime Aug 26, 2021
@balazsorban44 balazsorban44 temporarily deployed to Preview August 26, 2021 11:09 Inactive
β€’ Bring back `staleTime` (remove it on an up-coming PR)
β€’ Refine failed session flow
@vercel vercel bot temporarily deployed to Preview August 26, 2021 13:28 Inactive
@ubbe-xyz ubbe-xyz changed the title feat(react): remove staleTime test(client): fully cover client module Aug 26, 2021
@ubbe-xyz ubbe-xyz merged commit d76f15b into next Aug 26, 2021
@ubbe-xyz ubbe-xyz deleted the test/client-tests branch August 26, 2021 13:30
mnphpexpert added a commit to mnphpexpert/next-auth that referenced this pull request Sep 2, 2024
Contains:

* test(client-provider): fix flaky test
* wip
* test(client-provider): verify more use-cases
* test(client): programmatic session refetch
* test(client): further coverage
* test(client): `stateTime` + `refetchInterval`
* refactor(client): test insights
* refactor: unused variable
* chore: revert `package-lock.json` to  v2
* refactor: pair-review suggestions
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
client Client related code core Refers to `@auth/core` priority Priority fix or enhancement
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants