forked from githru/githru-vscode-ext
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(view): Commit 타입에 tag와 releaseTag가 추가됨에 따라 관련 테스트 코드 추가(githru#725)
- Loading branch information
Showing
3 changed files
with
87 additions
and
22 deletions.
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 |
---|---|---|
@@ -1,6 +1,6 @@ | ||
import type { ClusterNode } from "types"; | ||
|
||
import { getClusterById, getClusterIds, getInitData } from "./Summary.util"; | ||
import { getClusterById, getClusterIds, getInitData, getCommitLatestTag } from "./Summary.util"; | ||
|
||
const clusterNodeMockData: ClusterNode[] = [ | ||
{ | ||
|
@@ -20,8 +20,52 @@ const clusterNodeMockData: ClusterNode[] = [ | |
}, | ||
id: "71627b0568035fcf923e18a36b4f3f09fc1632c5", | ||
message: "Initial commit", | ||
tags: [], | ||
releaseTags: [], | ||
tags: ["v1.1.0", "v1.1.1"], | ||
releaseTags: ["v1.1.1"], | ||
parentIds: [], | ||
}, | ||
nodeTypeName: "COMMIT", | ||
seq: 1, | ||
}, | ||
{ | ||
clusterId: 1, | ||
commit: { | ||
author: { id: "no-id", emails: ["[email protected]"], names: ["ytaek"] }, | ||
authorDate: "Thu Apr 28 2022 01:19:50 GMT+0900 (Korean Standard Time)", | ||
commitDate: "Thu Apr 28 2022 01:19:50 GMT+0900 (Korean Standard Time)", | ||
committer: { emails: ["[email protected]"], id: "no-id", names: ["GitHub"] }, | ||
diffStatistics: { | ||
changedFileCount: 2, | ||
deletions: 0, | ||
insertions: 203, | ||
files: { LICENSE: { insertions: 201, deletions: 0 }, "README.md": { insertions: 2, deletions: 0 } }, | ||
}, | ||
id: "71627b0568035fcf923e18a36b4f3f09fc1632c5", | ||
message: "Initial commit", | ||
tags: ["v1.1.1", "v1.1.2"], | ||
releaseTags: ["v1.1.1", "v1.1.2"], | ||
parentIds: [], | ||
}, | ||
nodeTypeName: "COMMIT", | ||
seq: 1, | ||
}, | ||
{ | ||
clusterId: 2, | ||
commit: { | ||
author: { id: "no-id", emails: ["[email protected]"], names: ["ytaek"] }, | ||
authorDate: "Thu Apr 28 2022 01:19:50 GMT+0900 (Korean Standard Time)", | ||
commitDate: "Thu Apr 28 2022 01:19:50 GMT+0900 (Korean Standard Time)", | ||
committer: { emails: ["[email protected]"], id: "no-id", names: ["GitHub"] }, | ||
diffStatistics: { | ||
changedFileCount: 2, | ||
deletions: 0, | ||
insertions: 203, | ||
files: { LICENSE: { insertions: 201, deletions: 0 }, "README.md": { insertions: 2, deletions: 0 } }, | ||
}, | ||
id: "71627b0568035fcf923e18a36b4f3f09fc1632c5", | ||
message: "Initial commit", | ||
tags: ["v1.1.3"], | ||
releaseTags: ["v1.1.3", "v1.1.4"], | ||
parentIds: [], | ||
}, | ||
nodeTypeName: "COMMIT", | ||
|
@@ -33,7 +77,7 @@ const clusterNodeMockData: ClusterNode[] = [ | |
{ | ||
commitNodeList: [ | ||
{ | ||
clusterId: 1, | ||
clusterId: 3, | ||
commit: { | ||
author: { id: "no-id", emails: ["[email protected]"], names: ["ytaek"] }, | ||
authorDate: "Thu Apr 28 2022 01:19:50 GMT+0900 (Korean Standard Time)", | ||
|
@@ -80,7 +124,7 @@ test("getClusterIds test", () => { | |
|
||
expect(result).not.toBeUndefined(); | ||
expect(result[0]).toBe(0); | ||
expect(result[1]).toBe(1); | ||
expect(result[1]).toBe(3); | ||
expect(result).toHaveLength(2); | ||
}); | ||
|
||
|
@@ -91,4 +135,13 @@ test("getInitData test", () => { | |
expect(result[0].clusterId).toBe(0); | ||
expect(result[0].summary.authorNames[0][0]).toBe("ytaek"); | ||
expect(result[0].summary.content.message).toBe("Initial commit"); | ||
expect(result[0].clusterTags).toEqual(["v1.1.1", "v1.1.2", "v1.1.3", "v1.1.4"]); | ||
expect(result[0].clusterTags).toHaveLength(4); | ||
}); | ||
|
||
test("getCommitLatestTag test", () => { | ||
const clusters = getInitData(clusterNodeMockData); | ||
const result = getCommitLatestTag(clusters[0].clusterTags); | ||
|
||
expect(result).toBe("v1.1.4"); | ||
}); |
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