mirror of
https://github.com/mermaid-js/mermaid.git
synced 2025-09-16 22:09:57 +02:00
Merge branch 'develop' into sidv/typescript
* develop: chore(deps-dev): bump @commitlint/cli from 17.1.1 to 17.1.2 chore(deps-dev): bump terser-webpack-plugin from 5.3.5 to 5.3.6 chore(deps-dev): bump webpack-dev-server from 4.10.0 to 4.10.1 Fix gitGraph findLane function error Replacing replaceAll with replace Rework 'parseDuration' as a pure duration parsing Supports duration in decimal Create a more consistent 'parseDuration' Fix svgDraw return types Add more tests Fix nested types Fix nested types Add nested test Updating to version to 9.1.6
This commit is contained in:
@@ -495,7 +495,7 @@ describe('when parsing a gitGraph', function () {
|
||||
]);
|
||||
});
|
||||
|
||||
it('should handle merge ids', function () {
|
||||
it('should handle merge with custom ids, tags and typr', function () {
|
||||
const str = `gitGraph:
|
||||
commit
|
||||
branch testBranch
|
||||
@@ -509,7 +509,7 @@ describe('when parsing a gitGraph', function () {
|
||||
commit
|
||||
checkout main
|
||||
%% Merge ID and Tag (reverse order)
|
||||
merge testBranch2 id: "4-444" tag: "merge-tag2"
|
||||
merge testBranch2 id: "4-444" tag: "merge-tag2" type:HIGHLIGHT
|
||||
branch testBranch3
|
||||
checkout testBranch3
|
||||
commit
|
||||
@@ -552,6 +552,8 @@ describe('when parsing a gitGraph', function () {
|
||||
expect(testBranch2Merge.parents).toStrictEqual([testBranchMerge.id, testBranch2Commit.id]);
|
||||
expect(testBranch2Merge.tag).toBe('merge-tag2');
|
||||
expect(testBranch2Merge.id).toBe('4-444');
|
||||
expect(testBranch2Merge.customType).toBe(2);
|
||||
expect(testBranch2Merge.customId).toBe(true);
|
||||
|
||||
expect(testBranch3Merge.branch).toBe('main');
|
||||
expect(testBranch3Merge.parents).toStrictEqual([testBranch2Merge.id, testBranch3Commit.id]);
|
||||
@@ -686,6 +688,27 @@ describe('when parsing a gitGraph', function () {
|
||||
expect(e.message).toBe('Incorrect usage of "merge". Cannot merge a branch to itself');
|
||||
}
|
||||
});
|
||||
|
||||
it('should throw error when using existing id as merge ID', function () {
|
||||
const str = `gitGraph
|
||||
commit id: "1-111"
|
||||
branch testBranch
|
||||
commit id: "2-222"
|
||||
commit id: "3-333"
|
||||
checkout main
|
||||
merge testBranch id: "1-111"
|
||||
`;
|
||||
|
||||
try {
|
||||
parser.parse(str);
|
||||
// Fail test if above expression doesn't throw anything.
|
||||
expect(true).toBe(false);
|
||||
} catch (e) {
|
||||
expect(e.message).toBe(
|
||||
'Incorrect usage of "merge". Commit with id:1-111 already exists, use different custom Id'
|
||||
);
|
||||
}
|
||||
});
|
||||
it('should throw error when trying to merge branches having same heads', function () {
|
||||
const str = `gitGraph
|
||||
commit
|
||||
|
Reference in New Issue
Block a user