Skip to content

Commit

Permalink
Test to cover backticked attributeNames
Browse files Browse the repository at this point in the history
  • Loading branch information
ejscribner committed Dec 12, 2023
1 parent f09c1e0 commit 119b9ef
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions packages/mermaid/src/diagrams/er/parser/erDiagram.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -228,6 +228,18 @@ describe('when parsing ER diagram it...', function () {
}).toThrow();
});
});

it('should allow special characters inside of backticks', () => {
const entity = 'BOOK';
const specialChars = '.?",';
[...specialChars].forEach((specialChar, i) => {
const attribute = `String \`author${specialChar}firstname\``;
erDiagram.parser.parse(`erDiagram\n${entity} {\n${attribute}}`);
const entities = erDb.getEntities();
expect(Object.keys(entities).length).toBe(1);
expect(entities[entity].attributes.length).toBe(i + 1);
});
});
});

it('should allow an entity with a single attribute to be defined', function () {
Expand Down

0 comments on commit 119b9ef

Please sign in to comment.