Skip to content

Commit a80ced2

Browse files
author
Robert Kesterson
committed
Fix test script
1 parent 158b856 commit a80ced2

File tree

2 files changed

+26
-29
lines changed

2 files changed

+26
-29
lines changed

package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
"typescript": "^4.1.3"
2020
},
2121
"scripts": {
22-
"test": "mocha --exit"
22+
"test": "npx tsc && mocha --exit"
2323
},
2424
"main": "dist/index.js"
2525
}

test/pathBuilder.js

+25-28
Original file line numberDiff line numberDiff line change
@@ -1,37 +1,34 @@
1-
"use strict";
2-
const Node = require("../dist/node"),
3-
Edge = require("../dist/edge"),
4-
Path = require("../dist/path");
1+
const { Node, Edge, Path } = require("../dist/index");
52

63
class PathBuilder {
7-
constructor(nodeCount) {
8-
this.nodes = new Array();
9-
this.edges = new Array();
10-
this.currentAppendClass = Node;
11-
}
4+
constructor(nodeCount) {
5+
this.nodes = new Array();
6+
this.edges = new Array();
7+
this.currentAppendClass = Node;
8+
}
129

13-
append(obj) {
14-
if (!obj instanceof this.currentAppendClass)
15-
throw "Error in path build insertion order and types.";
16-
if (obj instanceof Node) return this._appendNode(obj);
17-
else return this._appendEdge(obj);
18-
}
10+
append(obj) {
11+
if (!obj instanceof this.currentAppendClass)
12+
throw "Error in path build insertion order and types.";
13+
if (obj instanceof Node) return this._appendNode(obj);
14+
else return this._appendEdge(obj);
15+
}
1916

20-
build() {
21-
return new Path(this.nodes, this.edges);
22-
}
17+
build() {
18+
return new Path(this.nodes, this.edges);
19+
}
2320

24-
_appendNode(node) {
25-
this.nodes.push(node);
26-
this.currentAppendClass = Edge;
27-
return this;
28-
}
21+
_appendNode(node) {
22+
this.nodes.push(node);
23+
this.currentAppendClass = Edge;
24+
return this;
25+
}
2926

30-
_appendEdge(edge) {
31-
this.edges.push(edge);
32-
this.currentAppendClass = Node;
33-
return this;
34-
}
27+
_appendEdge(edge) {
28+
this.edges.push(edge);
29+
this.currentAppendClass = Node;
30+
return this;
31+
}
3532
}
3633

3734
module.exports = PathBuilder;

0 commit comments

Comments
 (0)