#1704 Test and lint

This commit is contained in:
Knut Sveidqvist
2020-10-07 20:43:52 +02:00
parent 4b2d98129e
commit 582a045457
3 changed files with 30 additions and 12 deletions

View File

@@ -31,16 +31,18 @@ flowchart TD
subcontainer-child--> subcontainer-sibling
end
</div>
<div class="mermaid2" style="width: 50%; height: 400px;">
<div class="mermaid" style="width: 50%; height: 400px;">
flowchart TB
subgraph container_Beta
process_C-->Process_D
end
subgraph container_Alpha
process_A-->process_B
process_A-->|messages|process_C
b-->B
a-->c
subgraph B
c
end
subgraph A
a
b
B
end
process_B-->|via_AWSBatch|container_Beta
</div>
<div class="mermaid" style="width: 50%; height: 20%;">
flowchart TB

View File

@@ -414,7 +414,6 @@ export const defaultStyle = function() {
* Clears the internal graph db so that a new graph can be parsed.
*/
export const addSubGraph = function(_id, list, _title) {
// logger.warn('addSubgraph', _id, list, _title);
let id = _id.trim();
let title = _title;
if (_id === _title && _title.match(/\s/)) {
@@ -454,8 +453,25 @@ export const addSubGraph = function(_id, list, _title) {
subCount = subCount + 1;
const subGraph = { id: id, nodes: nodeList, title: title.trim(), classes: [] };
console.log('Adding', subGraph.id, subGraph.nodes);
/**
* Deletes an id from all subgraphs
*/
// const del = _id => {
// subGraphs.forEach(sg => {
// const pos = sg.nodes.indexOf(_id);
// if (pos >= 0) {
// sg.nodes.splice(pos, 1);
// }
// });
// };
// // Removes the members of this subgraph from any other subgraphs, a node only belong to one subgraph
// subGraph.nodes.forEach(_id => del(_id));
// Remove the members in the new subgraph if they already belong to another subgraph
subGraph.nodes.nodes = makeUniq(subGraph, subGraphs);
subGraph.nodes = makeUniq(subGraph, subGraphs).nodes;
subGraphs.push(subGraph);
subGraphLookup[id] = subGraph;
return id;
@@ -670,7 +686,6 @@ const exists = (allSgs, _id) => {
const makeUniq = (sg, allSubgraphs) => {
const res = [];
sg.nodes.forEach((_id, pos) => {
console.log('Checking: ', _id);
if (!exists(allSubgraphs, _id)) {
res.push(sg.nodes[pos]);
}

View File

@@ -244,8 +244,9 @@ describe('when parsing subgraphs', function() {
const res = flow.parser.parse(`flowchart TB
subgraph A
b-->B
a-->c
a
end
a-->c
subgraph B
c
end`);