-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathjest.setup.js
More file actions
41 lines (39 loc) · 890 Bytes
/
jest.setup.js
File metadata and controls
41 lines (39 loc) · 890 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
require('@testing-library/jest-dom')
// Mock canvas for testing
HTMLCanvasElement.prototype.getContext = jest.fn(() => ({
fillStyle: '',
fillRect: jest.fn(),
clearRect: jest.fn(),
getImageData: jest.fn(() => ({
data: new Array(4),
})),
putImageData: jest.fn(),
createImageData: jest.fn(() => []),
setTransform: jest.fn(),
drawImage: jest.fn(),
save: jest.fn(),
restore: jest.fn(),
scale: jest.fn(),
rotate: jest.fn(),
translate: jest.fn(),
transform: jest.fn(),
beginPath: jest.fn(),
closePath: jest.fn(),
moveTo: jest.fn(),
lineTo: jest.fn(),
clip: jest.fn(),
quadraticCurveTo: jest.fn(),
bezierCurveTo: jest.fn(),
arc: jest.fn(),
arcTo: jest.fn(),
isPointInPath: jest.fn(),
stroke: jest.fn(),
fill: jest.fn(),
}))
// Mock Image constructor
global.Image = class {
constructor() {
this.onload = null
this.src = ''
}
}