23 lines
533 B
TypeScript
Raw Normal View History

2020-04-24 12:02:32 +02:00
import test from 'ava';
2020-05-06 20:24:37 +02:00
import { Edge, Color } 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);
2020-04-28 11:26:21 +02:00
2020-04-28 08:39:57 +02:00
e.color = Color.white;
2020-05-06 20:24:37 +02:00
e.style = 'dashed';
2020-04-28 08:39:57 +02:00
const serialized = e.toString ();
2020-04-28 11:26:21 +02:00
2020-04-28 08:39:57 +02:00
t.is (serialized, 'foo -- bar [style="dashed",color="#ffffff"]');
});
test ('serialize directional', (t) => {
const e = new Edge ('foo', 'bar', true);
2020-04-28 11:26:21 +02:00
2020-04-24 17:01:26 +02:00
e.color = Color.white;
2020-05-06 20:24:37 +02:00
e.style = 'dashed';
2020-04-24 12:02:32 +02:00
const serialized = e.toString ();
2020-04-28 11:26:21 +02:00
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
});