Răsfoiți Sursa

test(llm-pi-ai): keep rejection assertions type-safe

Use a typed expected failure object and the current toThrow matcher in the new leading-system-image regression. This preserves the rejection test while avoiding deprecated matcher and unsafe-any diagnostics from the full type-aware lint gate.
Tianyi Cui 3 săptămâni în urmă
părinte
comite
7af8a596ce
1 a modificat fișierele cu 3 adăugiri și 3 ștergeri
  1. 3 3
      packages/llm/llm-pi-ai/tests/context.spec.ts

+ 3 - 3
packages/llm/llm-pi-ai/tests/context.spec.ts

@@ -485,11 +485,11 @@ describe('pi-ai system prompt source', () => {
     },
   ])('rejects a leading system $label on both conversion paths', async ({ content }) => {
     const options: GenerateOptions = { ...base, messages: [history('system', content), question] }
-    const error = expect.objectContaining({
+    const error = {
       code: 'UNSUPPORTED_CONTENT',
       message: 'pi-ai cannot represent an image in an in-history system message',
-    })
-    expect(() => toPiContext(options)).toThrowError(error)
+    }
+    expect(() => toPiContext(options)).toThrow(error.message)
     const readImageRequest = vi.fn()
     await expect(toPiContext(options, imageContext(projectionStore(readImageRequest)))).rejects.toMatchObject(error)
     expect(readImageRequest).not.toHaveBeenCalled()