feat: rename old -> v1 folder

This commit is contained in:
2026-09-10 20:23:45 +05:00
parent 1e5e096d5d
commit 33e3f3c4f0
60 changed files with 60 additions and 69 deletions
+43
View File
@@ -0,0 +1,43 @@
import { describe, expect, it } from "vitest";
import { executeStep } from "./executor";
import { makeImage } from "../../core/test-helpers";
import type { PixelImage } from "../../core/types";
function cloneOf(img: PixelImage): PixelImage {
return {
width: img.width,
height: img.height,
data: new Uint8ClampedArray(img.data),
};
}
describe("executeStep: прямой путь (среда без Worker)", () => {
it("возвращает результат инструмента", async () => {
const img = makeImage(1, 1, [[1, 2, 3, 4]]);
const out = await executeStep(
{ id: "stub", run: (i) => cloneOf(i) },
img,
{},
);
expect(out).toEqual(img);
});
it("пробрасывает ошибку инструмента как есть", async () => {
const boom = () => {
throw new Error("бум");
};
await expect(
executeStep(
{ id: "stub", run: boom },
makeImage(1, 1, [[0, 0, 0, 255]]),
{},
),
).rejects.toThrow("бум");
});
it("инструмент без run даёт понятную ошибку", async () => {
await expect(
executeStep({ id: "stub" }, makeImage(1, 1, [[0, 0, 0, 255]]), {}),
).rejects.toThrow("errors.noImageRun");
});
});