2020-05-17 17:17:39 +02:00
|
|
|
/*
|
|
|
|
* Copyright (C) Sapphirecode - All Rights Reserved
|
|
|
|
* This file is part of graphviz-builder which is released under MIT.
|
|
|
|
* See file 'LICENSE' for full license details.
|
|
|
|
* Created by Timo Hocker <timo@scode.ovh>, May 2020
|
|
|
|
*/
|
|
|
|
|
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
|
|
|
});
|