-
Notifications
You must be signed in to change notification settings - Fork 83
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
[view] AuthorBarChart util 함수 테스트 코드 작성 #740
Merged
Merged
Changes from all commits
Commits
Show all changes
19 commits
Select commit
Hold shift + click to select a range
6a58676
style: edit author bar chart width (200 to 250)
xxxjinn 63fae82
style: edit select-box styling
xxxjinn f50d7d7
feat: change select box from select tag to mui select
xxxjinn 30010f4
style: edit style branch select dropdown (add marginTop)
xxxjinn d763194
Merge branch 'main' of https://github.com/githru/githru-vscode-ext
xxxjinn 1b23726
Merge branch 'main' of https://github.com/githru/githru-vscode-ext
xxxjinn d16b546
feat: edit branch-list fake-assets for branch name length test
xxxjinn 7068d6e
feat: add BranchSelector.const file for branch name slice length
xxxjinn 2361f24
feat: add suffix (...) to branch name
xxxjinn 319f1da
Merge branch 'main' of https://github.com/githru/githru-vscode-ext
xxxjinn 92f8b2b
refactor(view): edit branch-list fake-assets
xxxjinn 6dcbdf0
Merge branch 'main' of https://github.com/githru/githru-vscode-ext
xxxjinn 3f2f967
Merge branch 'main' of https://github.com/githru/githru-vscode-ext
xxxjinn 75b0e35
Merge branch 'main' of https://github.com/githru/githru-vscode-ext
xxxjinn d3c8814
Merge branch 'main' of https://github.com/githru/githru-vscode-ext
xxxjinn ec87809
Merge branch 'main' of https://github.com/githru/githru-vscode-ext
xxxjinn 2c1397f
test(view): AuthorBarChart util test - return empty data
xxxjinn 272472c
test(view): AuthorBarChart util test- correctly provide commit inform…
xxxjinn 71707c3
Merge branch 'main' of https://github.com/githru/githru-vscode-ext
xxxjinn 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
92 changes: 92 additions & 0 deletions
92
packages/view/src/components/Statistics/AuthorBarChart/AuthorBarChart.util.test.ts
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,92 @@ | ||
import type { ClusterNode } from "types"; | ||
import type { Commit } from "types/Commit"; | ||
|
||
import { getDataByAuthor } from "./AuthorBarChart.util"; | ||
|
||
describe("getDataByAuthor", () => { | ||
it("should return empty array if no data is provided", () => { | ||
const fakeData: ClusterNode[] = []; | ||
const result = getDataByAuthor(fakeData); | ||
expect(result).toEqual([]); | ||
}); | ||
|
||
it("should correctly aggregate commit, insertion, and deletion for authors", () => { | ||
const fakeData: ClusterNode[] = [ | ||
{ | ||
nodeTypeName: "CLUSTER", | ||
commitNodeList: [ | ||
{ | ||
nodeTypeName: "COMMIT", | ||
commit: { | ||
id: "1", | ||
parentIds: ["0"], | ||
author: { names: ["xxxjinn"] }, | ||
committer: { names: ["xxxjinn"] }, | ||
authorDate: "2024-01-01T00:00:00Z", | ||
commitDate: "2024-01-01T00:00:00Z", | ||
diffStatistics: { | ||
insertions: 5, | ||
deletions: 3, | ||
}, | ||
message: "Initial commit", | ||
} as Commit, | ||
seq: 1, | ||
clusterId: 101, | ||
}, | ||
{ | ||
nodeTypeName: "COMMIT", | ||
commit: { | ||
id: "2", | ||
parentIds: ["1"], | ||
author: { names: ["xxxjinn"] }, | ||
committer: { names: ["xxxjinn"] }, | ||
authorDate: "2024-01-02T00:00:00Z", | ||
commitDate: "2024-01-02T00:00:00Z", | ||
diffStatistics: { | ||
insertions: 2, | ||
deletions: 1, | ||
}, | ||
message: "Second commit", | ||
} as Commit, | ||
seq: 2, | ||
clusterId: 101, | ||
}, | ||
{ | ||
nodeTypeName: "COMMIT", | ||
commit: { | ||
id: "3", | ||
parentIds: ["1"], | ||
author: { names: ["user2"] }, | ||
committer: { names: ["user2"] }, | ||
authorDate: "2024-01-03T00:00:00Z", | ||
commitDate: "2024-01-03T00:00:00Z", | ||
diffStatistics: { | ||
insertions: 3, | ||
deletions: 2, | ||
}, | ||
message: "Third commit", | ||
} as Commit, | ||
seq: 3, | ||
clusterId: 102, | ||
}, | ||
], | ||
}, | ||
]; | ||
|
||
const result = getDataByAuthor(fakeData); | ||
expect(result).toEqual([ | ||
{ | ||
name: "xxxjinn", | ||
commit: 2, | ||
insertion: 7, | ||
deletion: 4, | ||
}, | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. (사소) 기왕이면 Type 선언도 하면 좋지 않을까요? 😸 There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. approve를 두 개 받아버려서..!! 다음 tc pr 올릴 때 함께 반영해서 올리도록 하겠습니다! 감사합니다🙂🙂🙂 |
||
{ | ||
name: "user2", | ||
commit: 1, | ||
insertion: 3, | ||
deletion: 2, | ||
}, | ||
]); | ||
}); | ||
}); |
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.
👍👍👍👍👍