Skip to content
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 19 commits into from
Sep 30, 2024
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 Sep 8, 2024
63fae82
style: edit select-box styling
xxxjinn Sep 8, 2024
f50d7d7
feat: change select box from select tag to mui select
xxxjinn Sep 8, 2024
30010f4
style: edit style branch select dropdown (add marginTop)
xxxjinn Sep 8, 2024
d763194
Merge branch 'main' of https://github.com/githru/githru-vscode-ext
xxxjinn Sep 10, 2024
1b23726
Merge branch 'main' of https://github.com/githru/githru-vscode-ext
xxxjinn Sep 10, 2024
d16b546
feat: edit branch-list fake-assets for branch name length test
xxxjinn Sep 10, 2024
7068d6e
feat: add BranchSelector.const file for branch name slice length
xxxjinn Sep 10, 2024
2361f24
feat: add suffix (...) to branch name
xxxjinn Sep 10, 2024
319f1da
Merge branch 'main' of https://github.com/githru/githru-vscode-ext
xxxjinn Sep 11, 2024
92f8b2b
refactor(view): edit branch-list fake-assets
xxxjinn Sep 11, 2024
6dcbdf0
Merge branch 'main' of https://github.com/githru/githru-vscode-ext
xxxjinn Sep 12, 2024
3f2f967
Merge branch 'main' of https://github.com/githru/githru-vscode-ext
xxxjinn Sep 13, 2024
75b0e35
Merge branch 'main' of https://github.com/githru/githru-vscode-ext
xxxjinn Sep 24, 2024
d3c8814
Merge branch 'main' of https://github.com/githru/githru-vscode-ext
xxxjinn Sep 27, 2024
ec87809
Merge branch 'main' of https://github.com/githru/githru-vscode-ext
xxxjinn Sep 29, 2024
2c1397f
test(view): AuthorBarChart util test - return empty data
xxxjinn Sep 29, 2024
272472c
test(view): AuthorBarChart util test- correctly provide commit inform…
xxxjinn Sep 29, 2024
71707c3
Merge branch 'main' of https://github.com/githru/githru-vscode-ext
xxxjinn Sep 30, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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", () => {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍👍👍👍👍

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,
},
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

(사소) 기왕이면 Type 선언도 하면 좋지 않을까요? 😸

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

approve를 두 개 받아버려서..!! 다음 tc pr 올릴 때 함께 반영해서 올리도록 하겠습니다! 감사합니다🙂🙂🙂

{
name: "user2",
commit: 1,
insertion: 3,
deletion: 2,
},
]);
});
});
Loading