import fs from 'fs'; import test from 'ava'; import { Graph, Node } from '../lib'; const result = `subgraph cluster_bar_foo { subgraph cluster_bar_foo_baz { bar_foo_baz_asd } bar_foo_baz bar_foo_foo bar_foo_foo -> bar_foo_baz }`; test ('serialize', (t) => { const g = new Graph ('foo', 'bar'); t.is (g.full_name, 'bar_foo'); g.add_graph (() => { const graph = new Graph ('baz'); graph.add_node (() => new Node ('asd')); return graph; }); g.add_node (() => new Node ('baz')); g.add_node (() => new Node ('foo')); g.add_edge ('foo', 'baz'); const serialized = g.toString (); t.is (serialized, result); });