diff options
| author | Adam Malczewski <[email protected]> | 2026-05-23 05:06:12 +0900 |
|---|---|---|
| committer | Adam Malczewski <[email protected]> | 2026-05-23 05:06:12 +0900 |
| commit | 9287cccb29d135ea19f2612c26f3090c94820d8c (patch) | |
| tree | 2d68e8cacf6d71786f305d5f4a512a68f19137c5 /packages/core/tests | |
| parent | ef427d3eae77fca716c203dd8bd84939710c518a (diff) | |
| download | dispatch-9287cccb29d135ea19f2612c26f3090c94820d8c.tar.gz dispatch-9287cccb29d135ea19f2612c26f3090c94820d8c.zip | |
feat: add is_subagent flag to agents, fix all lint/type/test issues
- Add is_subagent checkbox to agent editor; subagents are hidden from Chat Settings
- Add is_subagent field to AgentDefinition type, TOML serialization, and API route
- Filter subagents from ModelSelector agent list
- Fix all biome lint/format errors across codebase (useLiteralKeys, noNonNullAssertion, noExplicitAny, formatting, import sorting)
- Fix svelte-check errors (type narrowing in SkillsBrowser, ToolPermissions, SidebarPanel)
- Fix a11y warnings in App.svelte (label-control associations)
- Fix test mocks missing BackgroundShellStore, BackgroundTranscriptStore, createWebSearchTool, createYoutubeTranscribeTool
- Update stale 409 test to match current message-queuing behavior
- Exclude packaging/ and release/ dirs from biome to avoid linting stale build artifacts
Diffstat (limited to 'packages/core/tests')
| -rw-r--r-- | packages/core/tests/config/loader.test.ts | 26 | ||||
| -rw-r--r-- | packages/core/tests/llm/provider.test.ts | 6 |
2 files changed, 16 insertions, 16 deletions
diff --git a/packages/core/tests/config/loader.test.ts b/packages/core/tests/config/loader.test.ts index a572425..de025de 100644 --- a/packages/core/tests/config/loader.test.ts +++ b/packages/core/tests/config/loader.test.ts @@ -27,14 +27,14 @@ describe("loadConfig", () => { it("parses simple string permissions", () => { writeToml(`[permissions]\nread = "allow"\nedit = "deny"\n`); const config = loadConfig(TMP); - expect(config.permissions["read"]).toBe("allow"); - expect(config.permissions["edit"]).toBe("deny"); + expect(config.permissions.read).toBe("allow"); + expect(config.permissions.edit).toBe("deny"); }); it("parses nested pattern permissions", () => { writeToml(`[permissions.bash]\n"npm test" = "allow"\n"*" = "ask"\n`); const config = loadConfig(TMP); - const bash = config.permissions["bash"] as Record<string, string>; + const bash = config.permissions.bash as Record<string, string>; expect(bash["npm test"]).toBe("allow"); expect(bash["*"]).toBe("ask"); }); @@ -42,27 +42,27 @@ describe("loadConfig", () => { it("ignores comment lines", () => { writeToml(`# this is a comment\n[permissions]\n# another comment\nread = "allow"\n`); const config = loadConfig(TMP); - expect(config.permissions["read"]).toBe("allow"); + expect(config.permissions.read).toBe("allow"); }); it("handles ~ expansion in nested keys", () => { writeToml(`[permissions.read]\n"~/projects/*" = "allow"\n`); const config = loadConfig(TMP); - const read = config.permissions["read"] as Record<string, string>; + const read = config.permissions.read as Record<string, string>; expect(read["~/projects/*"]).toBe("allow"); }); it("handles $HOME expansion in nested keys", () => { writeToml(`[permissions.read]\n"$HOME/docs/*" = "allow"\n`); const config = loadConfig(TMP); - const read = config.permissions["read"] as Record<string, string>; + const read = config.permissions.read as Record<string, string>; expect(read["$HOME/docs/*"]).toBe("allow"); }); it("parses quoted keys", () => { writeToml(`[permissions.bash]\n"git commit *" = "allow"\n"rm *" = "deny"\n`); const config = loadConfig(TMP); - const bash = config.permissions["bash"] as Record<string, string>; + const bash = config.permissions.bash as Record<string, string>; expect(bash["git commit *"]).toBe("allow"); expect(bash["rm *"]).toBe("deny"); }); @@ -72,11 +72,11 @@ describe("loadConfig", () => { `[permissions]\nread = "allow"\n\n[permissions.edit]\n"*" = "ask"\n"src/**" = "allow"\n\n[permissions.bash]\n"npm test" = "allow"\n"*" = "ask"\n`, ); const config = loadConfig(TMP); - expect(config.permissions["read"]).toBe("allow"); - const edit = config.permissions["edit"] as Record<string, string>; + expect(config.permissions.read).toBe("allow"); + const edit = config.permissions.edit as Record<string, string>; expect(edit["*"]).toBe("ask"); expect(edit["src/**"]).toBe("allow"); - const bash = config.permissions["bash"] as Record<string, string>; + const bash = config.permissions.bash as Record<string, string>; expect(bash["npm test"]).toBe("allow"); expect(bash["*"]).toBe("ask"); }); @@ -84,14 +84,14 @@ describe("loadConfig", () => { it("preserves # inside quoted string keys", () => { writeToml(`[permissions.bash]\n"file#1" = "allow"\n`); const config = loadConfig(TMP); - const bash = config.permissions["bash"] as Record<string, string>; + const bash = config.permissions.bash as Record<string, string>; expect(bash["file#1"]).toBe("allow"); }); it("strips inline comments on table headers", () => { writeToml(`[permissions.bash] # scripts\n"*" = "allow"\n`); const config = loadConfig(TMP); - const bash = config.permissions["bash"] as Record<string, string>; + const bash = config.permissions.bash as Record<string, string>; expect(bash["*"]).toBe("allow"); }); @@ -100,7 +100,7 @@ describe("loadConfig", () => { const pattern = `~${sep}projects${sep}*`; writeToml(`[permissions.read]\n"${pattern}" = "allow"\n`); const config = loadConfig(TMP); - const read = config.permissions["read"] as Record<string, string>; + const read = config.permissions.read as Record<string, string>; expect(read[pattern]).toBe("allow"); }); diff --git a/packages/core/tests/llm/provider.test.ts b/packages/core/tests/llm/provider.test.ts index 2a98556..fb5dca5 100644 --- a/packages/core/tests/llm/provider.test.ts +++ b/packages/core/tests/llm/provider.test.ts @@ -48,7 +48,7 @@ async function runTransform(prompt: unknown[]): Promise<unknown[]> { } )._middleware; - const result = await middleware[0]!.transformParams({ + const result = await middleware[0]?.transformParams({ type: "stream", params: { prompt }, }); @@ -75,7 +75,7 @@ describe("createProvider middleware", () => { )._middleware; const params = { prompt: [], temperature: 0.5 }; - const result = (await middleware[0]!.transformParams({ + const result = (await middleware[0]?.transformParams({ type: "generate", params, })) as Record<string, unknown>; @@ -130,7 +130,7 @@ describe("createProvider middleware", () => { // Content unchanged const content = msg.content as Array<Record<string, unknown>>; expect(content).toHaveLength(1); - expect(content[0]!.type).toBe("text"); + expect(content[0]?.type).toBe("text"); // reasoning_content always set, even empty const pm = msg.providerMetadata as Record<string, unknown>; |
