Correct one unit test and add another

This commit is contained in:
Ibrahim Wassouf 2023-07-06 22:17:33 -03:00
parent 42da53f58a
commit fad11bce95
1 changed files with 12 additions and 2 deletions

View File

@ -154,11 +154,21 @@ describe('when parsing ER diagram it...', function () {
expect(entities[entity].attributes[2].attributeName).toBe('author-ref[name](1)');
});
it('should allow asterisk at the start of title', function () {
it('should allow asterisk at the start of attribute name', function () {
const entity = 'BOOK';
const attribute = 'string *title';
erDiagram.parser.parse(`erDiagram\n${entity}{${attribute}}`);
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(1);
});
it('should allow asterisks at the start of attribute declared with type and name', () => {
const entity = 'BOOK';
const attribute = 'id *the_Primary_Key';
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(1);