From 6382dcf7c8f21c469e32eb57aca3732f6dda1b83 Mon Sep 17 00:00:00 2001 From: Nikolay Rozhkov Date: Wed, 19 Jun 2024 22:36:10 +0300 Subject: [PATCH] Added more specs for elk detector --- .../src/detector.spec.ts | 20 +++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/packages/mermaid-flowchart-elk/src/detector.spec.ts b/packages/mermaid-flowchart-elk/src/detector.spec.ts index 6e949c57b9..521b4357de 100644 --- a/packages/mermaid-flowchart-elk/src/detector.spec.ts +++ b/packages/mermaid-flowchart-elk/src/detector.spec.ts @@ -39,6 +39,26 @@ describe('flowchart-elk detector', () => { ).toBe(true); }); + // The error from the issue was reproduced with mindmap, so this is just an example + // what matters is the keyword somewhere inside graph definition + it('should check only the beginning of the line in search of keywords', () => { + expect( + detector('mindmap ["Descendant node in flowchart"]', { + flowchart: { + defaultRenderer: 'elk', + }, + }) + ).toBe(false) + + expect( + detector('mindmap ["Descendant node in graph"]', { + flowchart: { + defaultRenderer: 'elk', + }, + }) + ).toBe(false) + }); + it('should detect flowchart-elk', () => { expect(detector('flowchart-elk')).toBe(true); });