generated from Bside-Team-Four/nextjs-starter
-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
4 changed files
with
33 additions
and
14 deletions.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,14 +4,23 @@ import { renderWithProviders } from '@/utils/testHelper'; | |
|
||
import ProfileSetting from './index'; | ||
|
||
jest.mock('@/hooks/api/useGetMyProfile', () => jest.fn(() => ({ | ||
isLoading: false, | ||
data: { | ||
userName: 'Test POPO', | ||
schoolName: '포포 고등학교', | ||
grade: 1, | ||
email: '[email protected]', | ||
}, | ||
}))); | ||
|
||
describe('ProfileSetting', () => { | ||
const renderProfileSetting = () => renderWithProviders(<ProfileSetting />); | ||
|
||
it('프로필 정보를 화면에 보여준다.', () => { | ||
renderProfileSetting(); | ||
|
||
expect(screen.getByDisplayValue('Test POPO')).toBeInTheDocument(); | ||
expect(screen.getByDisplayValue('18세')).toBeInTheDocument(); | ||
expect(screen.getByDisplayValue('포포 고등학교')).toBeInTheDocument(); | ||
expect(screen.getByDisplayValue('1학년')).toBeInTheDocument(); | ||
expect(screen.getByDisplayValue('[email protected]')).toBeInTheDocument(); | ||
|
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 |
---|---|---|
@@ -1,18 +1,29 @@ | ||
import styled from 'styled-components'; | ||
|
||
import TextField from '@/components/common/TextField'; | ||
import fixtures from '@/fixtures'; | ||
import useGetMyProfile from '@/hooks/api/useGetMyProfile'; | ||
|
||
import FixedSpinner from '../common/FixedSpinner'; | ||
import LoadingHandler from '../common/LoadingHandler'; | ||
|
||
export default function ProfileSetting() { | ||
const { profile } = fixtures; | ||
const { | ||
isLoading, data = { | ||
userName: '', | ||
schoolName: '', | ||
grade: 0, | ||
email: '', | ||
}, | ||
} = useGetMyProfile(); | ||
|
||
return ( | ||
<Container> | ||
<TextField label="이름" value={profile.userName} readOnly /> | ||
<TextField label="나이" value="18세" readOnly /> | ||
<TextField label="학교" value={profile.schoolName} readOnly /> | ||
<TextField label="학년" value={`${profile.grade}학년`} readOnly /> | ||
<TextField label="이메일" value="[email protected]" readOnly /> | ||
<LoadingHandler isLoading={isLoading || !data} loadingComponent={<FixedSpinner type="normal" />}> | ||
<TextField label="이름" value={data.userName} readOnly key="userName" /> | ||
<TextField label="학교" value={data.schoolName} readOnly key="schoolName" /> | ||
<TextField label="학년" value={`${data.grade}학년`} readOnly key="grade" /> | ||
<TextField label="이메일" value={data.email} readOnly /> | ||
</LoadingHandler> | ||
</Container> | ||
); | ||
} | ||
|
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