test: update coverage, add some tests
This commit is contained in:
@@ -1,4 +1,3 @@
|
||||
import "@testing-library/jest-dom";
|
||||
import { vi } from "vitest";
|
||||
|
||||
// Extend global type
|
||||
@@ -31,36 +30,6 @@ Object.defineProperty(window, "crypto", {
|
||||
},
|
||||
});
|
||||
|
||||
// Mock HTMLCanvasElement for Konva testing
|
||||
Object.defineProperty(HTMLCanvasElement.prototype, "getContext", {
|
||||
value: vi.fn(() => ({
|
||||
fillRect: vi.fn(),
|
||||
clearRect: vi.fn(),
|
||||
getImageData: vi.fn(() => ({ data: new Array(4) })),
|
||||
putImageData: vi.fn(),
|
||||
createImageData: vi.fn(() => ({ data: new Array(4) })),
|
||||
setTransform: vi.fn(),
|
||||
drawImage: vi.fn(),
|
||||
save: vi.fn(),
|
||||
fillText: vi.fn(),
|
||||
restore: vi.fn(),
|
||||
beginPath: vi.fn(),
|
||||
moveTo: vi.fn(),
|
||||
lineTo: vi.fn(),
|
||||
closePath: vi.fn(),
|
||||
stroke: vi.fn(),
|
||||
translate: vi.fn(),
|
||||
scale: vi.fn(),
|
||||
rotate: vi.fn(),
|
||||
arc: vi.fn(),
|
||||
fill: vi.fn(),
|
||||
measureText: vi.fn(() => ({ width: 0 })),
|
||||
transform: vi.fn(),
|
||||
rect: vi.fn(),
|
||||
clip: vi.fn(),
|
||||
})),
|
||||
});
|
||||
|
||||
// Mock FileReader for image upload testing
|
||||
Object.defineProperty(window, "FileReader", {
|
||||
value: vi.fn(() => ({
|
||||
|
||||
Reference in New Issue
Block a user