import test from 'ava'; import { Node } from '../lib/Node'; const serialized_simple = 'bar_foo [label=]'; const serialized_table = `bar_foo [label=<
foobarbaz
barbazfoo
bazfoobar
>]`; test ('serialize simple', (t) => { const g = new Node ('foo', 'bar', 'baz'); const serialized = g.toString (); t.is (g.full_name, 'bar_foo'); t.is (serialized, serialized_simple); }); test ('serialize table', (t) => { const g = new Node ('foo', 'bar', 'baz'); g.table_contents = [ [ 'foo', 'bar', 'baz' ], [ 'bar', 'baz', 'foo' ], [ 'baz', 'foo', 'bar' ] ]; g.is_table = true; const serialized = g.toString (); t.is (g.full_name, 'bar_foo'); t.is (serialized, serialized_table); });