-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathjest.setup.js
More file actions
42 lines (36 loc) · 855 Bytes
/
jest.setup.js
File metadata and controls
42 lines (36 loc) · 855 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
42
const iconsWithNoErrors = require("./tests/mocks/figma-data/icons").default;
global.figma = {
// Core methods
createRectangle: jest.fn(),
createText: jest.fn(),
createFrame: jest.fn(),
createComponent: jest.fn(),
createPage: jest.fn(),
// Document properties
currentPage: {
selection: [],
appendChild: jest.fn(),
findAll: jest.fn(),
findOne: jest.fn(),
// Mock icons
children: iconsWithNoErrors,
},
root: {
children: [],
},
// UI methods
showUI: jest.fn(),
closePlugin: jest.fn(),
notify: jest.fn(),
// Messaging
ui: {
postMessage: jest.fn(),
onmessage: null,
resize: jest.fn(),
},
// Other common methods
getNodeById: jest.fn(),
getStyleById: jest.fn(),
listAvailableFonts: jest.fn(() => Promise.resolve([])),
loadFontAsync: jest.fn(() => Promise.resolve()),
};