generated from RealDevSquad/website-template
-
Notifications
You must be signed in to change notification settings - Fork 167
fix : removed multiple user/self fetch #603
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
Merged
bhtibrewal
merged 22 commits into
RealDevSquad:develop
from
Shah-Arsalan:refactor/removing-multiple-user-fetch
Jul 5, 2023
Merged
Changes from all commits
Commits
Show all changes
22 commits
Select commit
Hold shift + click to select a range
1d93804
fix : removed multiple user/self fetch
Shah-Arsalan 3b11018
refactor : removed useContext
Shah-Arsalan 1cd5aca
refactor : userData derivation from rtk store
Shah-Arsalan b85a6ef
refactor : abstracted authorizarion login
Shah-Arsalan 4d1db8c
fix : two tests fixed and one test added for hook
Shah-Arsalan 31663b7
fix : fixed tests and added one for hook
Shah-Arsalan fd3ef88
fix : minor fix to set data
Shah-Arsalan 56bed89
Merge branch 'develop' into refactor/removing-multiple-user-fetch
Shah-Arsalan a21c3ec
refactor : removed imports,fix in useAuthenticated
Shah-Arsalan 4df5b79
Merge branch 'refactor/removing-multiple-user-fetch' of https://githu…
Shah-Arsalan a69a2de
refactor : added types files
Shah-Arsalan a773969
refactor : move types useAuthenticated in one file
Shah-Arsalan 8223f59
fix : useUserData test
Shah-Arsalan 72205ed
Merge branch 'develop' into refactor/removing-multiple-user-fetch
Shah-Arsalan ad1e5a4
refactor : function name changes
Shah-Arsalan 1382280
Merge branch 'refactor/removing-multiple-user-fetch' of https://githu…
Shah-Arsalan 5dfd1e7
Merge branch 'develop' into refactor/removing-multiple-user-fetch
Shah-Arsalan 4328dc8
Merge branch 'develop' into refactor/removing-multiple-user-fetch
Shah-Arsalan d5c0f15
fix : remove redundant imort
Shah-Arsalan 31337bf
fix : remove comments
Shah-Arsalan 51a12b3
Merge branch 'develop' into refactor/removing-multiple-user-fetch
Shah-Arsalan 6f6bd0e
fix : prettier issue
Shah-Arsalan File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,37 @@ | ||
| import React, { PropsWithChildren } from 'react'; | ||
| import useUserData from '@/hooks/useUserData'; | ||
| import { setupServer } from 'msw/node'; | ||
| import handlers from '../../../__mocks__/handlers'; | ||
| import { store } from '@/app/store'; | ||
| import { act, renderHook } from '@testing-library/react-hooks'; | ||
| import { Provider } from 'react-redux'; | ||
|
|
||
| const server = setupServer(...handlers); | ||
|
|
||
| beforeAll(() => { | ||
| server.listen(); | ||
| }); | ||
| afterEach(() => server.resetHandlers()); | ||
| afterAll(() => server.close()); | ||
|
|
||
| function Wrapper({ | ||
| children, | ||
| }: PropsWithChildren<Record<string, never>>): JSX.Element { | ||
| return <Provider store={store()}>{children}</Provider>; | ||
| } | ||
|
|
||
| describe('useUserData', () => { | ||
| test('returns the user as not authorized ', async () => { | ||
| const { result, waitForNextUpdate } = renderHook(() => useUserData(), { | ||
| wrapper: Wrapper, | ||
| }); | ||
| const initialResponse = result.current; | ||
| expect(initialResponse.data).toBeUndefined(); | ||
|
|
||
| await act(() => waitForNextUpdate()); | ||
| const nextResponse = result.current; | ||
|
|
||
| expect(nextResponse.isSuccess).toBe(true); | ||
| expect(nextResponse.isUserAuthorized).toBe(false); | ||
| }); | ||
| }); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.