This commit is contained in:
2020-04-29 22:19:08 +02:00
parent 73db0afc1f
commit 1c6af8fa9d
2 changed files with 24 additions and 5 deletions

View File

@ -49,8 +49,18 @@ test ('serialize table', (t) => {
});
test ('adhere to naming convention', (t) => {
const n = new Node ('invalid.name', 'parent');
t.is (n.name, 'invalidname');
});
test ('throw on invalid name', (t) => {
t.throws (() => {
const n = new Node ('invalid.name', 'parent');
const n = new Node ('564#+-.,/@', 'parent');
return n.toString ();
}, { message: 'invalid name specified' });
});
test ('leave numbers after the first letter', (t) => {
const n = new Node ('i123nvalid.name', 'parent');
t.is (n.name, 'i123nvalidname');
});