-
Notifications
You must be signed in to change notification settings - Fork 51
test(bezier-react): Improved array
test coverage
#1775
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
Merged
Merged
Changes from 2 commits
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
3f02f3a
chore(bezier-react): rename isLastIndex -> isLastArrayIndex
SEOKKAMONI 1db1a0f
feat(bezier-react): add test case to array
SEOKKAMONI 06ca4d9
chore(bezier-react): rollback isLastArrayIndex -> isLastIndex
SEOKKAMONI 432ef4f
chore(bezier-react): changed type to isLastIndex
SEOKKAMONI 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 hidden or 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 hidden or 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,20 +1,37 @@ | ||
import { | ||
compact, | ||
flattenDeep, | ||
isLastArrayIndex, | ||
} from './array' | ||
|
||
describe('arrayUtils', () => { | ||
describe('compact', () => { | ||
it('should remove falsy item', () => { | ||
const array = [0, 1, false, 2, '', 3] | ||
expect(compact(array)).toEqual([1, 2, 3]) | ||
}) | ||
describe('isLastArrayIndex', () => { | ||
it('should return true when the last array index', () => { | ||
const arr = [0, 1, 2, 3, 4] | ||
|
||
const result = isLastArrayIndex(arr, 4) | ||
|
||
expect(result).toBe(true) | ||
}) | ||
|
||
it('should return false when not the last array index', () => { | ||
const arr = [0, 1, 2, 3, 4] | ||
|
||
const result = isLastArrayIndex(arr, 1) | ||
|
||
expect(result).toBe(false) | ||
}) | ||
}) | ||
|
||
describe('compact', () => { | ||
it('should remove falsy item', () => { | ||
const array = [0, 1, false, 2, '', 3] | ||
expect(compact(array)).toEqual([1, 2, 3]) | ||
}) | ||
}) | ||
|
||
describe('flattenDeep', () => { | ||
it('should return flatten array', () => { | ||
const array = [1, [2, [3, [4]], 5]] | ||
expect(flattenDeep(array)).toEqual([1, 2, 3, 4, 5]) | ||
}) | ||
describe('flattenDeep', () => { | ||
it('should return flatten array', () => { | ||
const array = [1, [2, [3, [4]], 5]] | ||
expect(flattenDeep(array)).toEqual([1, 2, 3, 4, 5]) | ||
}) | ||
}) |
This file contains hidden or 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.
이 PR의 범위는 아니지만, 지금보니 이 타입이 더 정확하겠네요 😅 유사배열도 length 프로퍼티를 가지고 있으니까요. 이렇게 변경할 경우
isLastIndex
라는 이름이 더 적절하지 않을까 생각이 드는데, 의견이 궁금합니다.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.
앗 유사 배열까지는 생각을 못 했던 것 같아요! 그러면 isLastIndex가 맞을 것 같아요 좋은 의견 감사합니다~
Uh oh!
There was an error while loading. Please reload this page.
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.
네이밍 롤백 타입 변경 두개의 커밋으로 나눠서 반영하였습니다~