chore: update eslint config, update tests, constants

This commit is contained in:
2026-02-17 17:40:38 +05:00
parent c6d16ca9c2
commit 185e80ae0e
21 changed files with 224 additions and 112 deletions
+10 -13
View File
@@ -2,7 +2,7 @@ import { DownloadService, type DownloadItem } from "$services/downloadService";
import { saveAs } from "file-saver";
import JSZip from "jszip";
import type { Stage } from "konva/lib/Stage";
import { beforeEach, describe, expect, it, vi } from "vitest";
import { assert, beforeEach, describe, expect, it, vi } from "vitest";
vi.mock("file-saver", () => {
return {
@@ -58,10 +58,9 @@ describe("DownloadService", () => {
"test-panel-1.png",
);
expect(result.success).toBe(false);
if (!result.success) {
expect(result.error).toContain("Konva Stage не найден или не поддерживает toBlob");
}
assert(result.success === false);
expect(result.error).toContain("Konva Stage не найден или не поддерживает toBlob");
});
it("should handle blob creation failure", async () => {
@@ -71,10 +70,9 @@ describe("DownloadService", () => {
const result = await service.downloadPanel(mockKonvaStage, "test-panel-1.png");
expect(result.success).toBe(false);
if (!result.success) {
expect(result.error).toContain("Не удалось создать изображение");
}
assert(result.success === false);
expect(result.error).toContain("Не удалось создать изображение");
});
});
@@ -122,10 +120,9 @@ describe("DownloadService", () => {
];
const result = await service.downloadAll(panels);
expect(result.success).toBe(false);
if (!result.success) {
expect(result.error).toContain("Ошибка сохранения архива");
}
assert(result.success === false);
expect(result.error).toContain("Ошибка сохранения архива");
});
});
});