2020-03-18 16:53:26 +00:00
|
|
|
/* eslint-env jest */
|
|
|
|
import { imgSnapshotTest } from '../../helpers/util';
|
|
|
|
|
|
|
|
describe('Entity Relationship Diagram', () => {
|
|
|
|
it('should render a simple ER diagram', () => {
|
|
|
|
imgSnapshotTest(
|
|
|
|
`
|
|
|
|
erDiagram
|
2020-03-29 08:42:20 +01:00
|
|
|
CUSTOMER ||--o{ ORDER : places
|
|
|
|
ORDER ||--|{ LINE-ITEM : contains
|
2020-03-18 16:53:26 +00:00
|
|
|
`,
|
|
|
|
{logLevel : 1}
|
|
|
|
);
|
|
|
|
cy.get('svg');
|
|
|
|
});
|
|
|
|
|
|
|
|
it('should render an ER diagram with a recursive relationship', () => {
|
|
|
|
imgSnapshotTest(
|
|
|
|
`
|
|
|
|
erDiagram
|
2020-03-29 08:42:20 +01:00
|
|
|
CUSTOMER ||..o{ CUSTOMER : refers
|
|
|
|
CUSTOMER ||--o{ ORDER : places
|
|
|
|
ORDER ||--|{ LINE-ITEM : contains
|
2020-03-18 16:53:26 +00:00
|
|
|
`,
|
|
|
|
{logLevel : 1}
|
|
|
|
);
|
|
|
|
cy.get('svg');
|
|
|
|
});
|
|
|
|
|
|
|
|
it('should render an ER diagram with multiple relationships between the same two entities', () => {
|
|
|
|
imgSnapshotTest(
|
|
|
|
`
|
|
|
|
erDiagram
|
2020-03-29 08:42:20 +01:00
|
|
|
CUSTOMER ||--|{ ADDRESS : "invoiced at"
|
|
|
|
CUSTOMER ||--|{ ADDRESS : "receives goods at"
|
2020-03-18 16:53:26 +00:00
|
|
|
`,
|
|
|
|
{logLevel : 1}
|
|
|
|
);
|
|
|
|
cy.get('svg');
|
|
|
|
});
|
|
|
|
|
|
|
|
it('should render a cyclical ER diagram', () => {
|
|
|
|
imgSnapshotTest(
|
|
|
|
`
|
|
|
|
erDiagram
|
2020-03-29 08:42:20 +01:00
|
|
|
A ||--|{ B : likes
|
|
|
|
B ||--|{ C : likes
|
|
|
|
C ||--|{ A : likes
|
2020-03-18 16:53:26 +00:00
|
|
|
`,
|
|
|
|
{logLevel : 1}
|
|
|
|
);
|
|
|
|
cy.get('svg');
|
|
|
|
});
|
|
|
|
|
|
|
|
it('should render a not-so-simple ER diagram', () => {
|
|
|
|
imgSnapshotTest(
|
|
|
|
`
|
|
|
|
erDiagram
|
2020-03-29 08:42:20 +01:00
|
|
|
CUSTOMER }|..|{ DELIVERY-ADDRESS : has
|
|
|
|
CUSTOMER ||--o{ ORDER : places
|
|
|
|
CUSTOMER ||--o{ INVOICE : "liable for"
|
|
|
|
DELIVERY-ADDRESS ||--o{ ORDER : receives
|
|
|
|
INVOICE ||--|{ ORDER : covers
|
|
|
|
ORDER ||--|{ ORDER-ITEM : includes
|
|
|
|
PRODUCT-CATEGORY ||--|{ PRODUCT : contains
|
|
|
|
PRODUCT ||--o{ ORDER-ITEM : "ordered in"
|
2020-03-18 16:53:26 +00:00
|
|
|
`,
|
|
|
|
{logLevel : 1}
|
|
|
|
);
|
|
|
|
cy.get('svg');
|
|
|
|
});
|
|
|
|
|
|
|
|
it('should render multiple ER diagrams', () => {
|
|
|
|
imgSnapshotTest(
|
|
|
|
[
|
|
|
|
`
|
|
|
|
erDiagram
|
2020-03-29 08:42:20 +01:00
|
|
|
CUSTOMER ||--o{ ORDER : places
|
|
|
|
ORDER ||--|{ LINE-ITEM : contains
|
2020-03-18 16:53:26 +00:00
|
|
|
`,
|
|
|
|
`
|
|
|
|
erDiagram
|
2020-03-29 08:42:20 +01:00
|
|
|
CUSTOMER ||--o{ ORDER : places
|
|
|
|
ORDER ||--|{ LINE-ITEM : contains
|
2020-03-18 16:53:26 +00:00
|
|
|
`
|
|
|
|
],
|
|
|
|
{logLevel : 1}
|
|
|
|
);
|
|
|
|
cy.get('svg');
|
|
|
|
});
|
2020-05-23 13:33:44 +01:00
|
|
|
|
|
|
|
it('should render an ER diagram with blank or empty labels', () => {
|
|
|
|
imgSnapshotTest(
|
|
|
|
`
|
|
|
|
erDiagram
|
|
|
|
BOOK }|..|{ AUTHOR : ""
|
|
|
|
BOOK }|..|{ GENRE : " "
|
|
|
|
AUTHOR }|..|{ GENRE : " "
|
|
|
|
`,
|
|
|
|
{logLevel : 1}
|
|
|
|
);
|
|
|
|
cy.get('svg');
|
|
|
|
});
|
2020-03-18 16:53:26 +00:00
|
|
|
});
|