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:
@@ -167,6 +167,14 @@ describe("blurFaces", () => {
|
||||
|
||||
await expect(blurFaces(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(blurFaces(FAKE_INPUT, FAKE_OUTPUT_DIR)).rejects.toThrow("out of memory");
|
||||
});
|
||||
});
|
||||
|
||||
describe("onProgress forwarding", () => {
|
||||
@@ -282,6 +290,14 @@ describe("detectFaces", () => {
|
||||
|
||||
await expect(detectFaces(FAKE_INPUT)).rejects.toThrow("segmentation fault");
|
||||
});
|
||||
|
||||
it("propagates OOM errors from bridge", async () => {
|
||||
vi.mocked(runPythonWithProgress).mockRejectedValue(
|
||||
new Error("Process killed (out of memory)"),
|
||||
);
|
||||
|
||||
await expect(detectFaces(FAKE_INPUT)).rejects.toThrow("out of memory");
|
||||
});
|
||||
});
|
||||
|
||||
describe("onProgress forwarding", () => {
|
||||
|
||||
Reference in New Issue
Block a user