Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update resolve-conflicts-test.js #366

Merged
merged 1 commit into from
Sep 11, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 16 additions & 16 deletions test/order/resolve-conflicts-test.js
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
var expect = require("../chai").expect;
var Graph = require("@dagrejs/graphlib").Graph;
var resolveConflicts = require("../../lib/order/resolve-conflicts");
let expect = require("../chai").expect;
let Graph = require("@dagrejs/graphlib").Graph;
let resolveConflicts = require("../../lib/order/resolve-conflicts");

describe("order/resolveConflicts", () => {
var cg;
let cg;

beforeEach(() => cg = new Graph());

it("returns back nodes unchanged when no constraints exist", () => {
var input = [
let input = [
{ v: "a", barycenter: 2, weight: 3 },
{ v: "b", barycenter: 1, weight: 2 }
];
Expand All @@ -19,7 +19,7 @@ describe("order/resolveConflicts", () => {
});

it("returns back nodes unchanged when no conflicts exist", () => {
var input = [
let input = [
{ v: "a", barycenter: 2, weight: 3 },
{ v: "b", barycenter: 1, weight: 2 }
];
Expand All @@ -31,7 +31,7 @@ describe("order/resolveConflicts", () => {
});

it("coalesces nodes when there is a conflict", () => {
var input = [
let input = [
{ v: "a", barycenter: 2, weight: 3 },
{ v: "b", barycenter: 1, weight: 2 }
];
Expand All @@ -46,7 +46,7 @@ describe("order/resolveConflicts", () => {
});

it("coalesces nodes when there is a conflict #2", () => {
var input = [
let input = [
{ v: "a", barycenter: 4, weight: 1 },
{ v: "b", barycenter: 3, weight: 1 },
{ v: "c", barycenter: 2, weight: 1 },
Expand All @@ -63,14 +63,14 @@ describe("order/resolveConflicts", () => {
});

it("works with multiple constraints for the same target #1", () => {
var input = [
let input = [
{ v: "a", barycenter: 4, weight: 1 },
{ v: "b", barycenter: 3, weight: 1 },
{ v: "c", barycenter: 2, weight: 1 },
];
cg.setEdge("a", "c");
cg.setEdge("b", "c");
var results = resolveConflicts(input, cg);
let results = resolveConflicts(input, cg);
expect(results).to.have.length(1);
expect(results[0].vs.indexOf("c")).to.be.gt(results[0].vs.indexOf("a"));
expect(results[0].vs.indexOf("c")).to.be.gt(results[0].vs.indexOf("b"));
Expand All @@ -80,7 +80,7 @@ describe("order/resolveConflicts", () => {
});

it("works with multiple constraints for the same target #2", () => {
var input = [
let input = [
{ v: "a", barycenter: 4, weight: 1 },
{ v: "b", barycenter: 3, weight: 1 },
{ v: "c", barycenter: 2, weight: 1 },
Expand All @@ -90,7 +90,7 @@ describe("order/resolveConflicts", () => {
cg.setEdge("a", "d");
cg.setEdge("b", "c");
cg.setEdge("c", "d");
var results = resolveConflicts(input, cg);
let results = resolveConflicts(input, cg);
expect(results).to.have.length(1);
expect(results[0].vs.indexOf("c")).to.be.gt(results[0].vs.indexOf("a"));
expect(results[0].vs.indexOf("c")).to.be.gt(results[0].vs.indexOf("b"));
Expand All @@ -101,7 +101,7 @@ describe("order/resolveConflicts", () => {
});

it("does nothing to a node lacking both a barycenter and a constraint", () => {
var input = [
let input = [
{ v: "a" },
{ v: "b", barycenter: 1, weight: 2 }
];
Expand All @@ -112,7 +112,7 @@ describe("order/resolveConflicts", () => {
});

it("treats a node w/o a barycenter as always violating constraints #1", () => {
var input = [
let input = [
{ v: "a" },
{ v: "b", barycenter: 1, weight: 2 }
];
Expand All @@ -123,7 +123,7 @@ describe("order/resolveConflicts", () => {
});

it("treats a node w/o a barycenter as always violating constraints #2", () => {
var input = [
let input = [
{ v: "a" },
{ v: "b", barycenter: 1, weight: 2 }
];
Expand All @@ -134,7 +134,7 @@ describe("order/resolveConflicts", () => {
});

it("ignores edges not related to entries", () => {
var input = [
let input = [
{ v: "a", barycenter: 2, weight: 3 },
{ v: "b", barycenter: 1, weight: 2 }
];
Expand Down
Loading