Begin implementing the functions that actually modify the game board

This commit is contained in:
Oliver Akins 2022-06-28 00:44:44 -06:00
parent 54ffc0a0f4
commit a7344e36e1
No known key found for this signature in database
GPG key ID: 3C2014AF9457AF99
3 changed files with 78 additions and 0 deletions

View file

@ -0,0 +1,25 @@
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;
});
});