-
Notifications
You must be signed in to change notification settings - Fork 83
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
f18f1d8
commit 1511730
Showing
7 changed files
with
69 additions
and
65 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,5 @@ | ||
# githru-vscode-ext | ||
|
||
Lightweight but robust Githru for VSCode Extension | ||
|
||
## Getting Started | ||
|
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,5 +1,5 @@ | ||
import { getCommitMessageType } from "./commit.util"; | ||
import getCommitRaws from "./parser"; | ||
import getCommitRaws from "./parser"; | ||
import type { CommitRaw, DifferenceStatistic } from "./types"; | ||
|
||
describe("commit message type", () => { | ||
|
@@ -34,85 +34,79 @@ describe("commit message type", () => { | |
}); | ||
}); | ||
|
||
describe('getCommitRaws', () => { | ||
describe("getCommitRaws", () => { | ||
const testCommitLines = [ | ||
"commit a b (HEAD)", | ||
"commit a b (HEAD -> main, origin/main, origin/HEAD)", | ||
"commit a b (HEAD, tag: v1.0.0)", | ||
"commit a b (HEAD -> main, origin/main, origin/HEAD, tag: v2.0.0)", | ||
"commit a b (HEAD, tag: v2.0.0, tag: v1.4)" | ||
"commit a b (HEAD, tag: v2.0.0, tag: v1.4)", | ||
]; | ||
|
||
const expectedBranches = [ | ||
['HEAD'], | ||
['HEAD', 'main', 'origin/main', 'origin/HEAD'], | ||
['HEAD'], | ||
['HEAD', 'main', 'origin/main', 'origin/HEAD'], | ||
['HEAD'] | ||
["HEAD"], | ||
["HEAD", "main", "origin/main", "origin/HEAD"], | ||
["HEAD"], | ||
["HEAD", "main", "origin/main", "origin/HEAD"], | ||
["HEAD"], | ||
]; | ||
|
||
const expectedTags = [ | ||
[], | ||
[], | ||
['v1.0.0'], | ||
['v2.0.0'], | ||
['v2.0.0', 'v1.4'] | ||
]; | ||
const expectedTags = [[], [], ["v1.0.0"], ["v2.0.0"], ["v2.0.0", "v1.4"]]; | ||
|
||
const testCommitFileChanges = [ | ||
"10\t0\ta.ts\n1\t0\tREADME.md", | ||
"3\t3\ta.ts", | ||
"4\t0\ta.ts", | ||
"0\t6\ta.ts\n2\t0\tb.ts\n3\t3\tc.ts" | ||
"0\t6\ta.ts\n2\t0\tb.ts\n3\t3\tc.ts", | ||
]; | ||
|
||
const expectedFileChanged:DifferenceStatistic[] = [ | ||
const expectedFileChanged: DifferenceStatistic[] = [ | ||
{ | ||
totalInsertionCount: 11, | ||
totalDeletionCount: 0, | ||
fileDictionary: { | ||
'a.ts': { insertionCount: 10, deletionCount: 0 }, | ||
'README.md': { insertionCount: 1, deletionCount: 0 }, | ||
} | ||
"a.ts": { insertionCount: 10, deletionCount: 0 }, | ||
"README.md": { insertionCount: 1, deletionCount: 0 }, | ||
}, | ||
}, | ||
{ | ||
totalInsertionCount: 3, | ||
totalDeletionCount: 3, | ||
fileDictionary: { 'a.ts': { insertionCount: 3, deletionCount: 3 } } | ||
fileDictionary: { "a.ts": { insertionCount: 3, deletionCount: 3 } }, | ||
}, | ||
{ | ||
totalInsertionCount: 4, | ||
totalDeletionCount: 0, | ||
fileDictionary: { 'a.ts': { insertionCount: 4, deletionCount: 0 } } | ||
fileDictionary: { "a.ts": { insertionCount: 4, deletionCount: 0 } }, | ||
}, | ||
{ | ||
totalInsertionCount: 5, | ||
totalDeletionCount: 9, | ||
fileDictionary: { | ||
'a.ts': { insertionCount: 0, deletionCount: 6 }, | ||
'b.ts': { insertionCount: 2, deletionCount: 0 }, | ||
'c.ts': { insertionCount: 3, deletionCount: 3 }, | ||
} | ||
} | ||
"a.ts": { insertionCount: 0, deletionCount: 6 }, | ||
"b.ts": { insertionCount: 2, deletionCount: 0 }, | ||
"c.ts": { insertionCount: 3, deletionCount: 3 }, | ||
}, | ||
}, | ||
]; | ||
|
||
const commonExpectatedResult: CommitRaw={ | ||
const commonExpectatedResult: CommitRaw = { | ||
sequence: 0, | ||
id: 'a', | ||
parents: ['b'], | ||
branches: ['HEAD'], | ||
id: "a", | ||
parents: ["b"], | ||
branches: ["HEAD"], | ||
tags: [], | ||
author: { name: 'John Park', email: '[email protected]' }, | ||
authorDate: new Date('Sun Sep 4 20:17:59 2022 +0900'), | ||
committer: { name: 'John Park', email: '[email protected]' }, | ||
committerDate: new Date('Sun Sep 4 20:17:59 2022 +0900'), | ||
message: 'commit message', | ||
author: { name: "John Park", email: "[email protected]" }, | ||
authorDate: new Date("Sun Sep 4 20:17:59 2022 +0900"), | ||
committer: { name: "John Park", email: "[email protected]" }, | ||
committerDate: new Date("Sun Sep 4 20:17:59 2022 +0900"), | ||
message: "commit message", | ||
differenceStatistic: { | ||
totalInsertionCount: 0, | ||
totalDeletionCount: 0, | ||
fileDictionary: {}, | ||
}, | ||
commitMessageType: "" | ||
commitMessageType: "", | ||
}; | ||
|
||
testCommitLines.forEach((mockLog, index) => { | ||
|
@@ -125,8 +119,12 @@ CommitDate: Sun Sep 4 20:17:59 2022 +0900 | |
\n\tcommit message | ||
`; | ||
const result = getCommitRaws(mock); | ||
const expectedResult = { ...commonExpectatedResult, branches: expectedBranches[index], tags: expectedTags[index] }; | ||
|
||
const expectedResult = { | ||
...commonExpectatedResult, | ||
branches: expectedBranches[index], | ||
tags: expectedTags[index], | ||
}; | ||
|
||
expect(result).toEqual([expectedResult]); | ||
}); | ||
}); | ||
|
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
11 changes: 2 additions & 9 deletions
11
packages/view/src/components/VerticalClusterList/VerticalClusterList.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
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