Gravwell-Online/common/src/algorithms/processCard.spec.ts

25 lines
No EOL
605 B
TypeScript

import { tractorBeam } from "./processCard";
import { expect } from "chai";
import "mocha";
describe("The tractorBeam function", () => {
it("should move the ships closer", () => {
let b = [
null, "p1", null, null, "p2", null, null, "p3", null
];
let nb = [...b];
tractorBeam(nb, 4, 1);
expect(nb).to.have.length(9);
expect(nb[0]).to.be.null;
expect(nb[1]).to.be.null;
expect(nb[2]).to.equal("p1");
expect(nb[3]).to.be.null;
expect(nb[4]).to.equal("p2");
expect(nb[5]).to.be.null;
expect(nb[6]).to.equal("p3");
expect(nb[7]).to.be.null;
expect(nb[8]).to.be.null;
});
});