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:
Alois Klink
2022-09-18 06:59:44 +01:00
committed by Ashley Engelund (weedySeaDragon @ github)
parent 51a94e6904
commit 95d92999bb

View File

@@ -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