refactor(ai): remove mode, add colorizeStrength to restore options

This commit is contained in:
SnapOtter
2026-05-13 16:55:38 +08:00
parent dd6ea16dd4
commit 693b441aa0
2 changed files with 9 additions and 16 deletions
+8 -15
View File
@@ -69,13 +69,6 @@ describe("restorePhoto", () => {
);
});
it("serializes mode option", async () => {
await restorePhoto(FAKE_INPUT, FAKE_OUTPUT_DIR, { mode: "heavy" });
const args = vi.mocked(runPythonWithProgress).mock.calls[0][1];
expect(JSON.parse(args[2])).toEqual({ mode: "heavy" });
});
it("serializes scratchRemoval option", async () => {
await restorePhoto(FAKE_INPUT, FAKE_OUTPUT_DIR, { scratchRemoval: true });
@@ -111,15 +104,22 @@ describe("restorePhoto", () => {
expect(JSON.parse(args[2])).toEqual({ colorize: true });
});
it("serializes colorizeStrength option", async () => {
await restorePhoto(FAKE_INPUT, FAKE_OUTPUT_DIR, { colorizeStrength: 60 });
const args = vi.mocked(runPythonWithProgress).mock.calls[0][1];
expect(JSON.parse(args[2])).toEqual({ colorizeStrength: 60 });
});
it("serializes all options together", async () => {
const allOptions = {
mode: "auto",
scratchRemoval: true,
faceEnhancement: true,
fidelity: 0.8,
denoise: true,
denoiseStrength: 0.5,
colorize: true,
colorizeStrength: 75,
};
await restorePhoto(FAKE_INPUT, FAKE_OUTPUT_DIR, allOptions);
@@ -354,12 +354,5 @@ describe("restorePhoto", () => {
await expect(restorePhoto(FAKE_INPUT, FAKE_OUTPUT_DIR)).rejects.toThrow("segmentation fault");
});
it("passes mode option", async () => {
await restorePhoto(FAKE_INPUT, FAKE_OUTPUT_DIR, { mode: "light" });
const args = vi.mocked(runPythonWithProgress).mock.calls[0][1];
expect(JSON.parse(args[2])).toEqual({ mode: "light" });
});
});
});