mirror of
https://github.com/kuhyx/testsAndMisc.git
synced 2026-07-04 11:43:10 +02:00
Frontend (React 19 + Vite 6 + TypeScript strict): - DropZone, ModeSelect, GameCanvas, PuzzleCanvas, ScoreScreen, PuzzleResult - File-drop game with AABB collision; download (JSZip) and upload (NestJS) modes - Puzzle mode: NxN image slice via OffscreenCanvas; Union-Find spatial clustering guarantees 100% catch rate is always achievable regardless of piece speeds - ESLint typescript-eslint strict-type-checked (zero errors) - 145 Vitest tests; 100% coverage on statements/branches/functions/lines Backend (NestJS 11): - POST /files/upload (multer disk storage) and GET /health Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01YZ8QTmreFcaqrsvVb38Grd
31 lines
789 B
TypeScript
31 lines
789 B
TypeScript
import { vi } from "vitest";
|
|
|
|
export const mockGradient = { addColorStop: vi.fn() };
|
|
|
|
export const mockCtx = {
|
|
clearRect: vi.fn(),
|
|
fillRect: vi.fn(),
|
|
strokeRect: vi.fn(),
|
|
drawImage: vi.fn(),
|
|
fillText: vi.fn(),
|
|
measureText: vi.fn(() => ({ width: 0 })),
|
|
save: vi.fn(),
|
|
restore: vi.fn(),
|
|
beginPath: vi.fn(),
|
|
arc: vi.fn(),
|
|
fill: vi.fn(),
|
|
stroke: vi.fn(),
|
|
moveTo: vi.fn(),
|
|
lineTo: vi.fn(),
|
|
roundRect: vi.fn(),
|
|
createLinearGradient: vi.fn(() => mockGradient),
|
|
fillStyle: "" as string | CanvasGradient | CanvasPattern,
|
|
strokeStyle: "" as string | CanvasGradient | CanvasPattern,
|
|
lineWidth: 1,
|
|
lineJoin: "miter" as CanvasLineJoin,
|
|
font: "",
|
|
textAlign: "start" as CanvasTextAlign,
|
|
textBaseline: "alphabetic" as CanvasTextBaseline,
|
|
globalAlpha: 1,
|
|
};
|