test: refactor and format test files

- Update `game.test.ts` to use `_ctx` when `this` is not required
- Fix type assertion in `boop.test.ts`
- Update `command-runner.test.ts` to use `parseCommandSchema` in prompt
  tests
- Reformat `middleware.test.ts` to use double quotes and consistent
  indentation
This commit is contained in:
2026-04-20 15:50:32 +08:00
parent 974c1a828c
commit 34cb828f60
4 changed files with 441 additions and 420 deletions
+13 -13
View File
@@ -201,7 +201,7 @@ describe("Boop Game", () => {
ctx.produce((state) => {
const whiteKitten = state.pieces["white-kitten-1"];
if (whiteKitten && whiteKitten.regionId === "board") {
whiteKitten.type = "cat";
(whiteKitten as { type: string }).type = "cat";
}
});
@@ -464,7 +464,7 @@ describe("Boop Game", () => {
const k3 = state.pieces["white-kitten-3"];
if (k1) {
k1.type = "cat";
(k1 as { type: string }).type = "cat";
k1.regionId = "board";
k1.position = [0, 0];
state.regions.board.partMap["0,0"] = k1.id;
@@ -473,7 +473,7 @@ describe("Boop Game", () => {
);
}
if (k2) {
k2.type = "cat";
(k2 as { type: string }).type = "cat";
k2.regionId = "board";
k2.position = [0, 1];
state.regions.board.partMap["0,1"] = k2.id;
@@ -482,7 +482,7 @@ describe("Boop Game", () => {
);
}
if (k3) {
k3.type = "cat";
(k3 as { type: string }).type = "cat";
k3.regionId = "board";
k3.position = [0, 2];
state.regions.board.partMap["0,2"] = k3.id;
@@ -510,7 +510,7 @@ describe("Boop Game", () => {
const k3 = state.pieces["black-kitten-3"];
if (k1) {
k1.type = "cat";
(k1 as { type: string }).type = "cat";
k1.regionId = "board";
k1.position = [0, 0];
state.regions.board.partMap["0,0"] = k1.id;
@@ -519,7 +519,7 @@ describe("Boop Game", () => {
);
}
if (k2) {
k2.type = "cat";
(k2 as { type: string }).type = "cat";
k2.regionId = "board";
k2.position = [1, 0];
state.regions.board.partMap["1,0"] = k2.id;
@@ -528,7 +528,7 @@ describe("Boop Game", () => {
);
}
if (k3) {
k3.type = "cat";
(k3 as { type: string }).type = "cat";
k3.regionId = "board";
k3.position = [2, 0];
state.regions.board.partMap["2,0"] = k3.id;
@@ -556,7 +556,7 @@ describe("Boop Game", () => {
const k3 = state.pieces["white-kitten-3"];
if (k1) {
k1.type = "cat";
(k1 as { type: string }).type = "cat";
k1.regionId = "board";
k1.position = [0, 0];
state.regions.board.partMap["0,0"] = k1.id;
@@ -565,7 +565,7 @@ describe("Boop Game", () => {
);
}
if (k2) {
k2.type = "cat";
(k2 as { type: string }).type = "cat";
k2.regionId = "board";
k2.position = [1, 1];
state.regions.board.partMap["1,1"] = k2.id;
@@ -574,7 +574,7 @@ describe("Boop Game", () => {
);
}
if (k3) {
k3.type = "cat";
(k3 as { type: string }).type = "cat";
k3.regionId = "board";
k3.position = [2, 2];
state.regions.board.partMap["2,2"] = k3.id;
@@ -740,7 +740,7 @@ describe("Boop Game", () => {
const c3 = state.pieces["white-cat-3"];
if (c1) {
c1.type = "cat";
(c1 as { type: string }).type = "cat";
c1.regionId = "board";
c1.position = [0, 0];
state.regions.board.partMap["0,0"] = c1.id;
@@ -749,7 +749,7 @@ describe("Boop Game", () => {
);
}
if (c2) {
c2.type = "cat";
(c2 as { type: string }).type = "cat";
c2.regionId = "board";
c2.position = [0, 1];
state.regions.board.partMap["0,1"] = c2.id;
@@ -758,7 +758,7 @@ describe("Boop Game", () => {
);
}
if (c3) {
c3.type = "cat";
(c3 as { type: string }).type = "cat";
c3.regionId = "board";
c3.position = [0, 2];
state.regions.board.partMap["0,2"] = c3.id;