-
Notifications
You must be signed in to change notification settings - Fork 172
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
[2단계 - 자동차 경주 리팩터링] 야미(이다인) 미션 제출합니다. #224
Merged
Merged
Changes from all commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
c53ebdb
rename: rename folders
feb-dain ab3216a
rename: rename folders
feb-dain 4f47c29
refactor: increase reusability of random number maker
feb-dain f1895ff
refactor: remove useless code
feb-dain 5a0924f
test: create test code for random number maker
feb-dain 65b95d1
refactor: rename method
feb-dain d50b4df
style: unify method style
feb-dain 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
const randomNumberBetween = require("../src/util/RandomNumberMaker"); | ||
|
||
test.each([ | ||
[0, 9], | ||
[1, 5], | ||
[2, 22], | ||
[3, 100], | ||
[4, 90], | ||
[5, 40], | ||
[6, 30], | ||
[7, 9], | ||
[8, 10], | ||
[9, 29], | ||
])("%i ~ %i 사이의 난수 반환", (min, max) => { | ||
expect(randomNumberBetween(min, max)).toBeGreaterThanOrEqual(min); | ||
expect(randomNumberBetween(min, max)).toBeLessThanOrEqual(max); | ||
}); |
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 was deleted.
Oops, something went wrong.
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
4 changes: 2 additions & 2 deletions
4
src/Domain/MovementIndicator.js → src/domain/MovementIndicator.js
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,8 +1,8 @@ | ||
const { MOVEMENT } = require("../Constants/Constants"); | ||
const { MOVEMENT } = require("../constant/Constants"); | ||
const { FORWARD_CONDITION_NUMBER, FORWARD_DISTANCE } = MOVEMENT; | ||
|
||
const movingDistance = (randomNumber) => { | ||
return randomNumber >= FORWARD_CONDITION_NUMBER ? FORWARD_DISTANCE : 0; | ||
}; | ||
|
||
module.exports = { movingDistance }; | ||
module.exports = movingDistance; |
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,5 @@ | ||
const randomNumberBetween = (min, max) => { | ||
return Math.floor(Math.random() * (max - min + 1) + min); | ||
}; | ||
|
||
module.exports = randomNumberBetween; |
2 changes: 1 addition & 1 deletion
2
src/Utils/SplitAndTrimString.js → src/util/SplitAndTrimString.js
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
File renamed without changes.
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
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.
min, max 값에 default Value를 선언해서 상수에 정의한 수를 주입하면 좀 더 확장성 있게 만들 수 있을 것 같네요!