Begin implementing the functions that actually modify the game board
This commit is contained in:
parent
54ffc0a0f4
commit
a7344e36e1
3 changed files with 78 additions and 0 deletions
25
common/src/algorithms/processCard.spec.ts
Normal file
25
common/src/algorithms/processCard.spec.ts
Normal 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;
|
||||
});
|
||||
});
|
||||
Loading…
Add table
Add a link
Reference in a new issue