mirror of
https://github.com/mermaid-js/mermaid.git
synced 2025-09-25 18:30:10 +02:00
Rmoved unnecessary imports in tests
This commit is contained in:
@@ -1,19 +1,18 @@
|
|||||||
import diagram from './sankey-arrow.jison';
|
// @ts-ignore: jison doesn't export types
|
||||||
import { parser } from './sankey-arrow.jison';
|
import sankey from './sankey-arrow.jison';
|
||||||
import db from '../sankeyDB.js';
|
import db from '../sankeyDB.js';
|
||||||
|
|
||||||
describe('sankey-beta diagram', function () {
|
describe('sankey-beta diagram', function () {
|
||||||
describe('when parsing an info graph it', function () {
|
describe('when parsing an info graph it', function () {
|
||||||
beforeEach(function () {
|
beforeEach(function () {
|
||||||
parser.yy = db;
|
sankey.parser.yy = db;
|
||||||
diagram.parser.yy = db;
|
sankey.parser.yy.clear();
|
||||||
diagram.parser.yy.clear();
|
|
||||||
});
|
});
|
||||||
|
|
||||||
it('recognizes its type', () => {
|
it('recognizes its type', () => {
|
||||||
const str = `sankey-beta`;
|
const str = `sankey-beta`;
|
||||||
|
|
||||||
parser.parse(str);
|
sankey.parser.parse(str);
|
||||||
});
|
});
|
||||||
|
|
||||||
it('recognizes one flow', () => {
|
it('recognizes one flow', () => {
|
||||||
@@ -22,7 +21,7 @@ describe('sankey-beta diagram', function () {
|
|||||||
node_a -> 30 -> node_b -> 20 -> node_c
|
node_a -> 30 -> node_b -> 20 -> node_c
|
||||||
`;
|
`;
|
||||||
|
|
||||||
parser.parse(str);
|
sankey.parser.parse(str);
|
||||||
});
|
});
|
||||||
|
|
||||||
it('recognizes multiple flows', () => {
|
it('recognizes multiple flows', () => {
|
||||||
@@ -33,7 +32,7 @@ describe('sankey-beta diagram', function () {
|
|||||||
node_c -> 40 -> node_e -> 12 -> node_q
|
node_c -> 40 -> node_e -> 12 -> node_q
|
||||||
`;
|
`;
|
||||||
|
|
||||||
parser.parse(str);
|
sankey.parser.parse(str);
|
||||||
});
|
});
|
||||||
|
|
||||||
it('parses node as a string', () => {
|
it('parses node as a string', () => {
|
||||||
@@ -44,7 +43,7 @@ describe('sankey-beta diagram', function () {
|
|||||||
"node c" -> 40 -> "node e" -> 12 -> "node q"
|
"node c" -> 40 -> "node e" -> 12 -> "node q"
|
||||||
`;
|
`;
|
||||||
|
|
||||||
parser.parse(str);
|
sankey.parser.parse(str);
|
||||||
});
|
});
|
||||||
|
|
||||||
describe('while attributes parsing', () => {
|
describe('while attributes parsing', () => {
|
||||||
@@ -54,7 +53,7 @@ describe('sankey-beta diagram', function () {
|
|||||||
1st -> 200 -> 2nd -> 180 -> 3rd;
|
1st -> 200 -> 2nd -> 180 -> 3rd;
|
||||||
`;
|
`;
|
||||||
|
|
||||||
parser.parse(str);
|
sankey.parser.parse(str);
|
||||||
});
|
});
|
||||||
|
|
||||||
it('parses different quotless variations', () => {
|
it('parses different quotless variations', () => {
|
||||||
@@ -70,7 +69,7 @@ describe('sankey-beta diagram', function () {
|
|||||||
node[x1dfqowie attr1 = 23413 attr2]
|
node[x1dfqowie attr1 = 23413 attr2]
|
||||||
`;
|
`;
|
||||||
|
|
||||||
parser.parse(str);
|
sankey.parser.parse(str);
|
||||||
});
|
});
|
||||||
|
|
||||||
it('parses strings as values', () => {
|
it('parses strings as values', () => {
|
||||||
@@ -80,7 +79,7 @@ describe('sankey-beta diagram', function () {
|
|||||||
node[title="hello, mister \\"sankey-beta\\", backslash for you \\\\"]
|
node[title="hello, mister \\"sankey-beta\\", backslash for you \\\\"]
|
||||||
`;
|
`;
|
||||||
|
|
||||||
parser.parse(str);
|
sankey.parser.parse(str);
|
||||||
});
|
});
|
||||||
|
|
||||||
it('parses real example', () => {
|
it('parses real example', () => {
|
||||||
@@ -95,7 +94,7 @@ describe('sankey-beta diagram', function () {
|
|||||||
"Biofuel imports" -> 35 -> "Liquid"
|
"Biofuel imports" -> 35 -> "Liquid"
|
||||||
`;
|
`;
|
||||||
|
|
||||||
parser.parse(str);
|
sankey.parser.parse(str);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
@@ -1,7 +1,5 @@
|
|||||||
// @ts-ignore: jison doesn't export types
|
// @ts-ignore: jison doesn't export types
|
||||||
import diagram from './sankey.jison';
|
import sankey from './sankey.jison';
|
||||||
// @ts-ignore: jison doesn't export types
|
|
||||||
import { parser } from './sankey.jison';
|
|
||||||
import db from '../sankeyDB.js';
|
import db from '../sankeyDB.js';
|
||||||
import { cleanupComments } from '../../../diagram-api/comments.js';
|
import { cleanupComments } from '../../../diagram-api/comments.js';
|
||||||
import { prepareTextForParsing } from '../sankeyUtils.js';
|
import { prepareTextForParsing } from '../sankeyUtils.js';
|
||||||
@@ -11,9 +9,8 @@ import * as path from 'path';
|
|||||||
describe('Sankey diagram', function () {
|
describe('Sankey diagram', function () {
|
||||||
describe('when parsing an info graph it', function () {
|
describe('when parsing an info graph it', function () {
|
||||||
beforeEach(function () {
|
beforeEach(function () {
|
||||||
parser.yy = db;
|
sankey.parser.yy = db;
|
||||||
diagram.parser.yy = db;
|
sankey.parser.yy.clear();
|
||||||
diagram.parser.yy.clear();
|
|
||||||
});
|
});
|
||||||
|
|
||||||
it('parses csv', async () => {
|
it('parses csv', async () => {
|
||||||
@@ -21,7 +18,7 @@ describe('Sankey diagram', function () {
|
|||||||
const data = fs.readFileSync(csv, 'utf8');
|
const data = fs.readFileSync(csv, 'utf8');
|
||||||
const graphDefinition = prepareTextForParsing(cleanupComments('sankey-beta\n\n ' + data));
|
const graphDefinition = prepareTextForParsing(cleanupComments('sankey-beta\n\n ' + data));
|
||||||
|
|
||||||
parser.parse(graphDefinition);
|
sankey.parser.parse(graphDefinition);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
Reference in New Issue
Block a user