Skip to content

Commit 39309ed

Browse files
Fix TypeScript compilation errors and test failures
Co-authored-by: patrick-knight <7575792+patrick-knight@users.noreply.github.com>
1 parent a6226d9 commit 39309ed

File tree

4 files changed

+68
-11
lines changed

4 files changed

+68
-11
lines changed

package-lock.json

Lines changed: 20 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/agents/chocolatier.test.ts

Lines changed: 32 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,8 @@ import { ContainerStatus, ContainerType } from "../docker/index.js";
1010
import type { MessageBroker } from "../messaging/index.js";
1111
import { MessageType } from "../messaging/index.js";
1212
import type { CocoMessage } from "../messaging/index.js";
13-
import type { CocoConfig, RepoState } from "../types/index.js";
13+
import type { CocoConfig } from "../types/index.js";
14+
import type { GlobalConfig, RepoState } from "../state/schemas.js";
1415

1516
// ---------------------------------------------------------------------------
1617
// Mocks
@@ -1033,11 +1034,19 @@ describe("Chocolatier", () => {
10331034

10341035
stateManager.getConfig.mockReturnValue({
10351036
workerTimeout: "4h",
1036-
} as Partial<CocoConfig>);
1037+
model: "claude-sonnet-4.5",
1038+
} as unknown as GlobalConfig);
10371039

10381040
stateManager.getRepo.mockReturnValue({
10391041
id: "repo-1",
10401042
name: "test-repo",
1043+
url: "https://github.com/test/test-repo",
1044+
localPath: "/tmp/test-repo",
1045+
mode: "single-player",
1046+
status: "active",
1047+
defaultBranch: "main",
1048+
createdAt: new Date().toISOString(),
1049+
updatedAt: new Date().toISOString(),
10411050
workers: {
10421051
Snickers: {
10431052
id: "w-1",
@@ -1051,7 +1060,7 @@ describe("Chocolatier", () => {
10511060
},
10521061
},
10531062
agents: {},
1054-
} as Partial<RepoState>);
1063+
} as unknown as Readonly<RepoState>);
10551064

10561065
containerManager.list.mockResolvedValue([]);
10571066
containerManager.stop.mockResolvedValue(undefined);
@@ -1082,11 +1091,19 @@ describe("Chocolatier", () => {
10821091

10831092
stateManager.getConfig.mockReturnValue({
10841093
workerTimeout: "4h",
1085-
} as Partial<CocoConfig>);
1094+
model: "claude-sonnet-4.5",
1095+
} as unknown as GlobalConfig);
10861096

10871097
stateManager.getRepo.mockReturnValue({
10881098
id: "repo-1",
10891099
name: "test-repo",
1100+
url: "https://github.com/test/test-repo",
1101+
localPath: "/tmp/test-repo",
1102+
mode: "single-player",
1103+
status: "active",
1104+
defaultBranch: "main",
1105+
createdAt: new Date().toISOString(),
1106+
updatedAt: new Date().toISOString(),
10901107
workers: {
10911108
Snickers: {
10921109
id: "w-1",
@@ -1100,7 +1117,7 @@ describe("Chocolatier", () => {
11001117
},
11011118
},
11021119
agents: {},
1103-
} as Partial<RepoState>);
1120+
} as unknown as Readonly<RepoState>);
11041121

11051122
containerManager.list.mockResolvedValue([
11061123
{
@@ -1130,11 +1147,19 @@ describe("Chocolatier", () => {
11301147

11311148
stateManager.getConfig.mockReturnValue({
11321149
workerTimeout: "4h",
1133-
} as Partial<CocoConfig>);
1150+
model: "claude-sonnet-4.5",
1151+
} as unknown as GlobalConfig);
11341152

11351153
stateManager.getRepo.mockReturnValue({
11361154
id: "repo-1",
11371155
name: "test-repo",
1156+
url: "https://github.com/test/test-repo",
1157+
localPath: "/tmp/test-repo",
1158+
mode: "single-player",
1159+
status: "active",
1160+
defaultBranch: "main",
1161+
createdAt: new Date().toISOString(),
1162+
updatedAt: new Date().toISOString(),
11381163
workers: {
11391164
Snickers: {
11401165
id: "w-1",
@@ -1148,7 +1173,7 @@ describe("Chocolatier", () => {
11481173
},
11491174
},
11501175
agents: {},
1151-
} as Partial<RepoState>);
1176+
} as unknown as Readonly<RepoState>);
11521177

11531178
containerManager.list.mockResolvedValue([]);
11541179
containerManager.stop.mockResolvedValue(undefined);

src/api/v1/workers.test.ts

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,14 @@ describe("POST /api/v1/workers", () => {
3939
});
4040

4141
it("returns 400 when task is missing", async () => {
42-
const sm = { getRepo: jest.fn() };
42+
const sm = {
43+
getRepo: jest.fn().mockReturnValue({
44+
id: "repo-1",
45+
name: "my-app",
46+
localPath: "/tmp/my-app",
47+
defaultBranch: "main",
48+
})
49+
};
4350
const broker = { send: jest.fn() };
4451
const app = createApp(sm, broker);
4552

src/server/routes/workers.test.ts

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,14 @@ describe("POST /api/v1/repositories/:repoName/workers", () => {
3838
});
3939

4040
it("returns 400 when task is missing", async () => {
41-
const sm = { getRepo: jest.fn() };
41+
const sm = {
42+
getRepo: jest.fn().mockReturnValue({
43+
id: "repo-1",
44+
name: "my-app",
45+
localPath: "/tmp/my-app",
46+
defaultBranch: "main",
47+
})
48+
};
4249
const broker = { send: jest.fn() };
4350
const app = createApp(sm, broker);
4451

0 commit comments

Comments
 (0)