-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
useHeader Hooks의 userid, user, isMyAccount State에 값이 잘 들어가는지 체크
- Loading branch information
Showing
2 changed files
with
18 additions
and
1 deletion.
There are no files selected for viewing
This file contains 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 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,17 @@ | ||
import { customRenderHook } from 'util/customRenderHook'; | ||
import { MOCK_INFO } from '__mocks__/data/auth'; | ||
import useHeader from './useHeader'; | ||
|
||
describe('useHeader Testing', () => { | ||
beforeEach(() => { | ||
localStorage.setItem('access_token', 'testToken'); | ||
}); | ||
it('Return Value Correctly', async () => { | ||
const { result, waitForNextUpdate } = customRenderHook(() => useHeader()); | ||
await waitForNextUpdate(); | ||
expect(result.current.userId).toEqual(['손민재', 'USER']); | ||
await waitForNextUpdate(); | ||
expect(result.current.user).toEqual(MOCK_INFO.data); | ||
expect(result.current.isMyAccount).toEqual(true); | ||
}); | ||
}); |