2020-04-24 12:02:32 +02:00
|
|
|
import test from 'ava';
|
2020-04-24 17:01:26 +02:00
|
|
|
import { Edge, Color, EdgeStyles } from '../lib';
|
2020-04-24 12:02:32 +02:00
|
|
|
|
|
|
|
test ('serialize', (t) => {
|
2020-04-28 08:39:57 +02:00
|
|
|
const e = new Edge ('foo', 'bar', false);
|
|
|
|
e.color = Color.white;
|
|
|
|
e.style = EdgeStyles.dashed;
|
|
|
|
const serialized = e.toString ();
|
|
|
|
t.is (serialized, 'foo -- bar [style="dashed",color="#ffffff"]');
|
|
|
|
});
|
|
|
|
|
|
|
|
test ('serialize directional', (t) => {
|
|
|
|
const e = new Edge ('foo', 'bar', true);
|
2020-04-24 17:01:26 +02:00
|
|
|
e.color = Color.white;
|
|
|
|
e.style = EdgeStyles.dashed;
|
2020-04-24 12:02:32 +02:00
|
|
|
const serialized = e.toString ();
|
2020-04-24 17:01:26 +02:00
|
|
|
t.is (serialized, 'foo -> bar [style="dashed",color="#ffffff"]');
|
2020-04-24 12:02:32 +02:00
|
|
|
});
|