From fd7406b94aab05db8775c1573b773d234a1a0e5c Mon Sep 17 00:00:00 2001 From: Sidharth Vinod Date: Tue, 5 Sep 2023 21:41:49 +0530 Subject: [PATCH] chore: Fix unit tests --- .../src/diagrams/class/classDiagram.spec.ts | 18 ++++++++---------- 1 file changed, 8 insertions(+), 10 deletions(-) diff --git a/packages/mermaid/src/diagrams/class/classDiagram.spec.ts b/packages/mermaid/src/diagrams/class/classDiagram.spec.ts index 19e31e6d23..532c8aaa7a 100644 --- a/packages/mermaid/src/diagrams/class/classDiagram.spec.ts +++ b/packages/mermaid/src/diagrams/class/classDiagram.spec.ts @@ -814,19 +814,17 @@ describe('given a class diagram with members and methods ', function () { }); it('should handle direct member declaration', function () { - const str = 'classDiagram\n' + 'Car : wheels'; - - parser.parse(str); - expect(classDb.getClasses()).toHaveProperty('Car'); - expect(classDb.getClasses()['Car']['members']).toContain('wheels'); + parser.parse('classDiagram\n' + 'Car : wheels'); + const car = classDb.getClass('Car'); + expect(car.members.length).toBe(1); + expect(car.members[0].id).toBe('wheels'); }); it('should handle direct member declaration with type', function () { - const str = 'classDiagram\n' + 'Car : int wheels'; - - parser.parse(str); - expect(classDb.getClasses()).toHaveProperty('Car'); - expect(classDb.getClasses()['Car']['members']).toContain('int wheels'); + parser.parse('classDiagram\n' + 'Car : int wheels'); + const car = classDb.getClass('Car'); + expect(car.members.length).toBe(1); + expect(car.members[0].id).toBe('int wheels'); }); it('should handle simple member declaration with type', function () {