mirror of
https://github.com/openclaw/openclaw.git
synced 2026-04-12 09:41:11 +00:00
chore(llm-task): drop dead test lint comments
This commit is contained in:
@@ -52,7 +52,6 @@ const runEmbeddedPiAgent = vi.fn(async () => ({
|
||||
payloads: [{ text: "{}" }],
|
||||
}));
|
||||
|
||||
// oxlint-disable-next-line typescript/no-explicit-any
|
||||
function fakeApi(overrides: any = {}) {
|
||||
return {
|
||||
id: "llm-task",
|
||||
@@ -75,7 +74,6 @@ function fakeApi(overrides: any = {}) {
|
||||
}
|
||||
|
||||
function mockEmbeddedRunJson(payload: unknown) {
|
||||
// oxlint-disable-next-line typescript/no-explicit-any
|
||||
(runEmbeddedPiAgent as any).mockResolvedValueOnce({
|
||||
meta: {},
|
||||
payloads: [{ text: JSON.stringify(payload) }],
|
||||
@@ -85,7 +83,6 @@ function mockEmbeddedRunJson(payload: unknown) {
|
||||
async function executeEmbeddedRun(input: Record<string, unknown>) {
|
||||
const tool = createLlmTaskTool(fakeApi());
|
||||
await tool.execute("id", input);
|
||||
// oxlint-disable-next-line typescript/no-explicit-any
|
||||
return (runEmbeddedPiAgent as any).mock.calls[0]?.[0];
|
||||
}
|
||||
|
||||
@@ -93,31 +90,26 @@ describe("llm-task tool (json-only)", () => {
|
||||
beforeEach(() => vi.clearAllMocks());
|
||||
|
||||
it("returns parsed json", async () => {
|
||||
// oxlint-disable-next-line typescript/no-explicit-any
|
||||
(runEmbeddedPiAgent as any).mockResolvedValueOnce({
|
||||
meta: {},
|
||||
payloads: [{ text: JSON.stringify({ foo: "bar" }) }],
|
||||
});
|
||||
const tool = createLlmTaskTool(fakeApi());
|
||||
const res = await tool.execute("id", { prompt: "return foo" });
|
||||
// oxlint-disable-next-line typescript/no-explicit-any
|
||||
expect((res as any).details.json).toEqual({ foo: "bar" });
|
||||
});
|
||||
|
||||
it("strips fenced json", async () => {
|
||||
// oxlint-disable-next-line typescript/no-explicit-any
|
||||
(runEmbeddedPiAgent as any).mockResolvedValueOnce({
|
||||
meta: {},
|
||||
payloads: [{ text: '```json\n{"ok":true}\n```' }],
|
||||
});
|
||||
const tool = createLlmTaskTool(fakeApi());
|
||||
const res = await tool.execute("id", { prompt: "return ok" });
|
||||
// oxlint-disable-next-line typescript/no-explicit-any
|
||||
expect((res as any).details.json).toEqual({ ok: true });
|
||||
});
|
||||
|
||||
it("validates schema", async () => {
|
||||
// oxlint-disable-next-line typescript/no-explicit-any
|
||||
(runEmbeddedPiAgent as any).mockResolvedValueOnce({
|
||||
meta: {},
|
||||
payloads: [{ text: JSON.stringify({ foo: "bar" }) }],
|
||||
@@ -130,12 +122,10 @@ describe("llm-task tool (json-only)", () => {
|
||||
additionalProperties: false,
|
||||
};
|
||||
const res = await tool.execute("id", { prompt: "return foo", schema });
|
||||
// oxlint-disable-next-line typescript/no-explicit-any
|
||||
expect((res as any).details.json).toEqual({ foo: "bar" });
|
||||
});
|
||||
|
||||
it("throws on invalid json", async () => {
|
||||
// oxlint-disable-next-line typescript/no-explicit-any
|
||||
(runEmbeddedPiAgent as any).mockResolvedValueOnce({
|
||||
meta: {},
|
||||
payloads: [{ text: "not-json" }],
|
||||
@@ -145,7 +135,6 @@ describe("llm-task tool (json-only)", () => {
|
||||
});
|
||||
|
||||
it("throws on schema mismatch", async () => {
|
||||
// oxlint-disable-next-line typescript/no-explicit-any
|
||||
(runEmbeddedPiAgent as any).mockResolvedValueOnce({
|
||||
meta: {},
|
||||
payloads: [{ text: JSON.stringify({ foo: 1 }) }],
|
||||
|
||||
Reference in New Issue
Block a user