import test from 'ava'; import { Graph, GraphStyles, Color } from '../lib'; const result = `digraph foo { subgraph cluster_foo_baz { color = #ff0000 style = bold foo_baz_asd [label=] } foo_baz [label=] foo_foo [label=] foo_foo -> foo_baz }`; test ('serialize', (t) => { const g = new Graph ('foo'); t.is (g.full_name, 'foo'); g.add_graph ((graph) => { graph.name = 'baz'; graph.add_node ('asd'); graph.style = GraphStyles.bold; graph.color = Color.red; }); g.add_node ('baz'); g.add_node ('foo'); g.add_edge ('foo', 'baz'); const serialized = g.toString (); t.is (serialized, result); });