mirror of
https://github.com/samiyev/puaros.git
synced 2025-12-27 23:06:54 +05:00
test(ipuaro): improve test coverage to 92% branches
- Raise branch coverage threshold from 90% to 92% - Add 21 new edge-case tests across modules - Watchdog: add tests for error handling, flushAll, polling mode - OllamaClient: add tests for AbortError and model not found - GetLinesTool: add tests for filesystem fallback, undefined params - GetClassTool: add tests for undefined extends, error handling - GetFunctionTool: add tests for error handling, undefined returnType Coverage results: - Lines: 97.83% (threshold 95%) - Branches: 92.01% (threshold 92%) - Functions: 99.16% (threshold 95%) - Statements: 97.83% (threshold 95%) - Total tests: 1441 (all passing)
This commit is contained in:
@@ -484,5 +484,23 @@ describe("OllamaClient", () => {
|
||||
|
||||
await expect(client.pullModel("test")).rejects.toThrow(/Failed to pull model/)
|
||||
})
|
||||
|
||||
it("should handle AbortError correctly", async () => {
|
||||
const abortError = new Error("aborted")
|
||||
abortError.name = "AbortError"
|
||||
mockOllamaInstance.chat.mockRejectedValue(abortError)
|
||||
|
||||
const client = new OllamaClient(defaultConfig)
|
||||
|
||||
await expect(client.chat([createUserMessage("Hello")])).rejects.toThrow(/Request was aborted/)
|
||||
})
|
||||
|
||||
it("should handle model not found errors", async () => {
|
||||
mockOllamaInstance.chat.mockRejectedValue(new Error("model 'unknown' not found"))
|
||||
|
||||
const client = new OllamaClient(defaultConfig)
|
||||
|
||||
await expect(client.chat([createUserMessage("Hello")])).rejects.toThrow(/Model.*not found/)
|
||||
})
|
||||
})
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user