Skip to content

Commit

Permalink
mend
Browse files Browse the repository at this point in the history
  • Loading branch information
tomperr committed Aug 24, 2023
1 parent aeb936b commit c0255d9
Showing 1 changed file with 15 additions and 1 deletion.
16 changes: 15 additions & 1 deletion packages/mermaid/src/diagrams/er/parser/erDiagram.spec.js
Expand Up @@ -143,7 +143,7 @@ describe('when parsing ER diagram it...', function () {
expect(entities[entity].alias).toBe(alias);
});

it('can have an alias even if the relationship is defined first', function () {
it('can have an alias even if the relationship is defined before class', function () {
const firstEntity = 'foo';
const secondEntity = 'bar';
const alias = 'batman';
Expand All @@ -156,6 +156,20 @@ describe('when parsing ER diagram it...', function () {
expect(entities[firstEntity].alias).toBe(alias);
expect(entities[secondEntity].alias).toBeUndefined();
});

it('can have an alias even if the relationship is defined after class', function () {
const firstEntity = 'foo';
const secondEntity = 'bar';
const alias = 'batman';
erDiagram.parser.parse(
`erDiagram\nclass ${firstEntity}["${alias}"]\n${firstEntity} ||--o| ${secondEntity} : rel\n`
);
const entities = erDb.getEntities();
expect(entities.hasOwnProperty(firstEntity)).toBe(true);
expect(entities.hasOwnProperty(secondEntity)).toBe(true);
expect(entities[firstEntity].alias).toBe(alias);
expect(entities[secondEntity].alias).toBeUndefined();
});
});

describe('attribute name', () => {
Expand Down

0 comments on commit c0255d9

Please sign in to comment.