Correct one unit test and add another
This commit is contained in:
parent
42da53f58a
commit
fad11bce95
|
@ -154,11 +154,21 @@ describe('when parsing ER diagram it...', function () {
|
||||||
expect(entities[entity].attributes[2].attributeName).toBe('author-ref[name](1)');
|
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 entity = 'BOOK';
|
||||||
const attribute = 'string *title';
|
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();
|
const entities = erDb.getEntities();
|
||||||
expect(Object.keys(entities).length).toBe(1);
|
expect(Object.keys(entities).length).toBe(1);
|
||||||
expect(entities[entity].attributes.length).toBe(1);
|
expect(entities[entity].attributes.length).toBe(1);
|
||||||
|
|
Loading…
Reference in New Issue