From 98bf9b4cb4e3f6bbda27650975891fe117489a66 Mon Sep 17 00:00:00 2001 From: Krishna Upadhyay <24423580+kriss-u@users.noreply.github.com> Date: Thu, 10 Jul 2025 22:17:30 -0500 Subject: [PATCH] test: add tests for directions in flowchart --- .../src/diagrams/flowchart/flowDb.spec.ts | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/packages/mermaid/src/diagrams/flowchart/flowDb.spec.ts b/packages/mermaid/src/diagrams/flowchart/flowDb.spec.ts index 8d12de00b..56d3cfb57 100644 --- a/packages/mermaid/src/diagrams/flowchart/flowDb.spec.ts +++ b/packages/mermaid/src/diagrams/flowchart/flowDb.spec.ts @@ -126,3 +126,20 @@ describe('flow db getData', () => { expect(edges[0].curve).toBe('basis'); }); }); + +describe('flow db direction', () => { + let flowDb: FlowDB; + beforeEach(() => { + flowDb = new FlowDB(); + }); + + it('should set direction to TB when TD is set', () => { + flowDb.setDirection('TD'); + expect(flowDb.getDirection()).toBe('TB'); + }); + + it('should correctly set direction irrespective of leading spaces', () => { + flowDb.setDirection(' TD'); + expect(flowDb.getDirection()).toBe('TB'); + }); +});