mirror of
https://github.com/snapotter-hq/SnapOtter.git
synced 2026-08-03 07:46:42 +02:00
test: add OOM and downscaling test coverage across AI features
Add 12 tests for background-removal downscaling (resize gate, portrait orientation, mask upscale) and OOM model fallback (retry with u2net, progress callback, no-retry guards, cascading failure). Add OOM propagation tests to face-detection, noise-removal, red-eye-removal, and OCR -- the four AI features that were missing them.
This commit is contained in:
@@ -235,6 +235,14 @@ describe("extractText", () => {
|
||||
await expect(extractText(FAKE_INPUT, FAKE_OUTPUT_DIR)).rejects.toThrow("timed out");
|
||||
});
|
||||
|
||||
it("propagates OOM errors from bridge", async () => {
|
||||
vi.mocked(runPythonWithProgress).mockRejectedValue(
|
||||
new Error("Process killed (out of memory)"),
|
||||
);
|
||||
|
||||
await expect(extractText(FAKE_INPUT, FAKE_OUTPUT_DIR)).rejects.toThrow("out of memory");
|
||||
});
|
||||
|
||||
it("propagates parseStdoutJson errors", async () => {
|
||||
vi.mocked(parseStdoutJson).mockImplementation(() => {
|
||||
throw new Error("No JSON response from Python script");
|
||||
|
||||
Reference in New Issue
Block a user