Skip to content

Commit

Permalink
Update feasible-tree-test.js
Browse files Browse the repository at this point in the history
  • Loading branch information
RohitPaul0007 authored Sep 9, 2023
1 parent 215449a commit 64b59af
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions test/rank/feasible-tree-test.js
Original file line number Diff line number Diff line change
@@ -1,29 +1,29 @@
var expect = require("../chai").expect;
var Graph = require("@dagrejs/graphlib").Graph;
var feasibleTree = require("../../lib/rank/feasible-tree");
let expect = require("../chai").expect;
let Graph = require("@dagrejs/graphlib").Graph;
let feasibleTree = require("../../lib/rank/feasible-tree");

describe("feasibleTree", () => {
it("creates a tree for a trivial input graph", () => {
var g = new Graph()
let g = new Graph()
.setNode("a", { rank: 0 })
.setNode("b", { rank: 1 })
.setEdge("a", "b", { minlen: 1 });

var tree = feasibleTree(g);
let tree = feasibleTree(g);
expect(g.node("b").rank).to.equal(g.node("a").rank + 1);
expect(tree.neighbors("a")).to.eql(["b"]);
});

it("correctly shortens slack by pulling a node up", () => {
var g = new Graph()
let g = new Graph()
.setNode("a", { rank: 0 })
.setNode("b", { rank: 1 })
.setNode("c", { rank: 2 })
.setNode("d", { rank: 2 })
.setPath(["a", "b", "c"], { minlen: 1 })
.setEdge("a", "d", { minlen: 1 });

var tree = feasibleTree(g);
let tree = feasibleTree(g);
expect(g.node("b").rank).to.eql(g.node("a").rank + 1);
expect(g.node("c").rank).to.eql(g.node("b").rank + 1);
expect(g.node("d").rank).to.eql(g.node("a").rank + 1);
Expand All @@ -34,7 +34,7 @@ describe("feasibleTree", () => {
});

it("correctly shortens slack by pulling a node down", () => {
var g = new Graph()
let g = new Graph()
.setNode("a", { rank: 2 })
.setNode("b", { rank: 0 })
.setNode("c", { rank: 2 })
Expand Down

0 comments on commit 64b59af

Please sign in to comment.