diff --git a/__mocks__/data/users.ts b/__mocks__/data/users.ts index 181701a..2b77ada 100644 --- a/__mocks__/data/users.ts +++ b/__mocks__/data/users.ts @@ -16,7 +16,7 @@ export const MOCK_TOTALUSERS: ITotalUserRankResponse = { totalContributions: 2100, user: { id: 'user_id_value', - name: 'Clzzi', + name: '손민재', }, userImage: 'http://test.jpg', }, diff --git a/hooks/header/useHeader.test.tsx b/hooks/header/useHeader.test.tsx new file mode 100644 index 0000000..c765595 --- /dev/null +++ b/hooks/header/useHeader.test.tsx @@ -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); + }); +});