mirror of
https://github.com/mermaid-js/mermaid.git
synced 2025-09-23 17:29:54 +02:00
test(git): add basic parsing test for cherry-pick
Currently, cherry-pick in gitGraphs only has e2e tests, no parsing unit tests.
This commit is contained in:

committed by
Ashley Engelund (weedySeaDragon @ github)

parent
51a94e6904
commit
95d92999bb
@@ -611,6 +611,22 @@ describe('when parsing a gitGraph', function () {
|
|||||||
]);
|
]);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
it('should support cherry-picking commits', function () {
|
||||||
|
const str = `gitGraph
|
||||||
|
commit id: "ZERO"
|
||||||
|
branch develop
|
||||||
|
commit id:"A"
|
||||||
|
checkout main
|
||||||
|
cherry-pick id:"A"
|
||||||
|
`;
|
||||||
|
|
||||||
|
parser.parse(str);
|
||||||
|
const commits = parser.yy.getCommits();
|
||||||
|
const cherryPickCommitID = Object.keys(commits)[2];
|
||||||
|
expect(commits[cherryPickCommitID].tag).toBe('cherry-pick:A');
|
||||||
|
expect(commits[cherryPickCommitID].branch).toBe('main');
|
||||||
|
});
|
||||||
|
|
||||||
it('should throw error when try to branch existing branch: main', function () {
|
it('should throw error when try to branch existing branch: main', function () {
|
||||||
const str = `gitGraph
|
const str = `gitGraph
|
||||||
commit
|
commit
|
||||||
|
Reference in New Issue
Block a user