From 262bf4e2b055868f0a28737637e85380295757ba Mon Sep 17 00:00:00 2001 From: Sidharth Vinod Date: Tue, 20 Aug 2024 14:25:52 +0530 Subject: [PATCH] chore: Simplify unit test --- .../src/diagrams/timeline/timeline.spec.js | 21 ++++++++++++------- 1 file changed, 14 insertions(+), 7 deletions(-) diff --git a/packages/mermaid/src/diagrams/timeline/timeline.spec.js b/packages/mermaid/src/diagrams/timeline/timeline.spec.js index 8cc990dcf9..a7005cada9 100644 --- a/packages/mermaid/src/diagrams/timeline/timeline.spec.js +++ b/packages/mermaid/src/diagrams/timeline/timeline.spec.js @@ -109,10 +109,13 @@ describe('when parsing a timeline ', function () { timeline.parse(str); expect(commonDb.getDiagramTitle()).equal(';my;title;'); expect(timelineDB.getSections()).to.deep.equal([';a;bc-123;']); - expect(timelineDB.getTasks()[0].task).equal(';ta;sk1;'); - expect(timelineDB.getTasks()[0].events[0]).equal(';ev;ent1; '); - expect(timelineDB.getTasks()[0].events[1]).equal(';ev;ent2; '); - expect(timelineDB.getTasks()[0].events[2]).equal(';ev;ent3;'); + expect(timelineDB.getTasks()[0].events).toMatchInlineSnapshot(` + [ + ";ev;ent1; ", + ";ev;ent2; ", + ";ev;ent3;", + ] + `); }); it('should handle a title, section, task, and events with hashtags', function () { @@ -125,9 +128,13 @@ describe('when parsing a timeline ', function () { expect(commonDb.getDiagramTitle()).equal('#my#title#'); expect(timelineDB.getSections()).to.deep.equal(['#a#bc-123#']); expect(timelineDB.getTasks()[0].task).equal('task1'); - expect(timelineDB.getTasks()[0].events[0]).equal('#ev#ent1# '); - expect(timelineDB.getTasks()[0].events[1]).equal('#ev#ent2# '); - expect(timelineDB.getTasks()[0].events[2]).equal('#ev#ent3#'); + expect(timelineDB.getTasks()[0].events).toMatchInlineSnapshot(` + [ + "#ev#ent1# ", + "#ev#ent2# ", + "#ev#ent3#", + ] + `); }); }); });