-
Notifications
You must be signed in to change notification settings - Fork 9
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
refactor: 테스트 리팩토링 #99
Merged
Merged
Changes from all commits
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
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 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
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 |
---|---|---|
@@ -1 +1 @@ | ||
export { loadScript, NamespaceNotAvailableError, ScriptLoadFailedError } from './loadScript' | ||
export { loadScript } from './loadScript' |
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
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
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.
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.
mockScriptElement 라는 이름이 document.createElement 를 mocking 한다는걸 드러내는게 아닐까요?
그래서 이 함수 내부에서 아래 로직도 함께 처리해줄거라고 기대할 것 같아요~
그리고 eventListeners 는 없애도 되지 않을까요? 두가지 역할을 하고 있는데, 이벤트 핸들러 hijacking 없이도 trigger 를 할 수 있는 방법이 있어서요~
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.
mocking을 유틸 밖으로 뺀 이유는 아래처럼 script 생성이 여러번 될 때의 테스트를 작성하기 위함이었는데, 성현님 말씀대로 mocking 동작이
mockScriptElement
밖에서 처리되는 게 많이 이상하긴 하네요~ 현재는 위 요구사항이 필요한 테스트는 없지만, 생긴다고 해도mockScriptElement
유틸 내부에서 독립적으로 처리할 수 있는 방법을 찾아 적용해야 할 것 같네요! 감사합니다~ 👍 b357b7e요건 dispatchEvent 메소드 생각을 못했습니다ㅋㅋ.. 훨씬 좋네요! f557119
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.
아하, 전 요것도 시나리오를 나눠보면, 아래처럼 mocking 시점을 분리해서 해결할 수 있지 않을까? 생각하긴 했어요~ 만약 안된다면 다른 방법을 찾아보긴 해야겠네요 😄