import { graphToDot } from '@datahub/shared/utils/graph/graph-to-dot'; import { module, test } from 'qunit'; import { simpleGraph } from '../../../../tests/helpers/graph/graphs'; import { moveAttributeEdgesToEdges } from '@datahub/shared/utils/graph/graph-transformations'; module('Unit | Utility | graph-to-dot', function(_hooks): void { test('it works', function(assert): void { const result = graphToDot(moveAttributeEdgesToEdges(simpleGraph)); assert.equal( result.trim().replace(/\s+/gi, ' '), ` digraph { graph [ rankdir = \"LR\" bgcolor = \"none\" ]; node [ fontsize = \"16\" fontname = \"helvetica, open-sans\" shape = \"none\" margin = \"0\" ]; edge []; ranksep = 2 \"id1\" [ id = \"ENTITY::id1\" label = <
displayName1
attributestring
referenceDisplayName2
> ] \"id2\" [ id = \"ENTITY::id2\" label = <
displayName2
attributestring
> ] \"id1\":reference -> \"id2\":root [ id = \"EDGE::id1::reference::id2\" label = \"displayName1:reference\" ] }` .trim() .replace(/\s+/gi, ' ') ); }); });