-
Notifications
You must be signed in to change notification settings - Fork 0
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
Sign in/#58 #58
Sign in/#58 #58
Conversation
Sign up form/#7
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
고생하셨습니다!
app/business/user/user.command.ts
Outdated
function isValidation<T extends z.ZodObject<any>>(data: any, schema: T): data is z.infer<T> { | ||
try { | ||
schema.parse(data); | ||
return true; | ||
} catch (error) { | ||
return false; | ||
} | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
이 함수가 user.validation.ts가 아닌 user.command.ts에 있는 이유가 따로 있을까요??
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
- 정확하게 말하면, 이 함수는 user 도메인뿐만 아니라 모든 zod 기반의 유효성 검사 상황에서 사용할 수 있어서, 어디에 위치시킬지 고민이었습니다.
- 이 함수가 zod에 강한 의존성을 가지고 있다고 판단하여, utils 폴더에 zod 폴더를 만들어서 해당 함수를 배치했습니다.
- '특정 라이브러리의 이름을 폴더 구조의 이름으로 사용해도 되는가?'에 대한 고민이 있었지만, util 계층이 모든 계층에서 사용 가능한 계층임을 고려하면, 외부 요소와 인터랙션을 위한 어댑터를 여기다 만들어 두는 것이 생각보다 괜찮다고 판단했습니다. 또한 이미 shadcn 폴더도 존재하고 있습니다.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
const signInData = await request.json(); | ||
|
||
const isSuccess = mockDatabase.signIn(signInData); | ||
await delay(500); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
혹시 delay를 걸어주지 않으면 오류가 발생하나용?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
아니요. 오류는 발생하지 않으며, delay는 실제동작을 모사하기 위한 장치입니다.
decorators: [ | ||
(Story) => ( | ||
<div className="w-96"> | ||
<Story /> | ||
</div> | ||
), | ||
], |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
decorators: [ | |
(Story) => ( | |
<div className="w-96"> | |
<Story /> | |
</div> | |
), | |
], | |
decorators: [ | |
(Story) => { | |
const beforeEach = () => { | |
resetMockDB(); | |
mockDatabase.createUser({ | |
authId: 'testtest', | |
password: 'test1234!', | |
studentNumber: '60000001', | |
engLv: 'ENG12', | |
}); | |
}; | |
beforeEach(); | |
return ( | |
<div className="w-96"> | |
<Story /> | |
</div> | |
); | |
}, | |
], |
이렇게 해서 반복적인 코드를 줄일 수 있을 것 같아요!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
- 오호, 정말 좋네요! 스토리북 테스트에서 beforeEach를 만들지 못하는 것이 가장 큰 문제였는데, 해결된 것 같습니다.
- 너무 고마워요
interface SignInFormProps { | ||
onNext?: () => void; | ||
} | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
onNext 함수를 props로 받는 이유가 따로 있을까요?!
- form 이 성공하면 페이지 이동을 할텐데 SignInForm에서 처리하지 않는 이유가 따로 있을까요!?
- funnel이라면 onNext 라는 이름이 적절해보이는데 그게 아니라면 페이지 이동 요론 네이밍이 더 적절하지 않을까용?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
- 사실 로그인에도 퍼널을 적용하려고 했지만, 라우팅이 더 적합해보이네요. 그렇게 되면 prop을 받을 필요가 없어 보입니다.
- 이 부분은 다음 브랜치에서 작업해도 괜찮을까요? 테스트 모킹이 변경되어야 하는데, 그 부분이 다음 작업 시에 결정될 것 같습니다.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
넵!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
next의 cookies가 storybook 환경에서 동작하지 않아 webpack의 alias 기능을 활용하여 모킹했습니다. 개발 환경에서는 cookies가 잘 작동하는 것을 확인했습니다.
Invariant: cookies() expects to have requestAsyncStorage, none available.
webpack의 alias 기능을 활용하여 모킹하지 않을 경우, 어떤 에러를 반환하는지 궁금해서 제거해봤고, 해당 에러문구가 노출되는 것을 확인했습니다. 혹시 next/headers의 cookies가 서버컴포넌트에서만 동작하는 특징과 해당 에러 케이스가 연관있다고 생각하시나요?
Co-authored-by: 박가현 <[email protected]>
4c8bf01 제안해주신 커밋에 대한 답변입니다
|
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
고생하셨습니다!
📌 작업 내용
🤔 고민 했던 부분
🔊 도움이 필요한 부분