This repository has been archived by the owner on Sep 26, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 3
/
setup-tests-globals.js
105 lines (102 loc) · 2.63 KB
/
setup-tests-globals.js
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
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
/**
* A setup files used by jest for adding
* mock objects to the global namespace that
* the Tooling expects to be there.
*/
const t = () => true;
const f = () => false;
const obj = () => ({});
const arr = () => [];
const noop = () => {};
const str = () => 'xxx';
// The global ManyWho object
window.manywho = {
adminTenantId: 'test',
cdnUrl: '',
component: {
handleEvent: jest.fn(),
getChildComponents: jest.fn(),
getByName: jest.fn(),
getOutcomes: jest.fn(),
getSelectedRows: jest.fn(),
onOutcome: jest.fn(),
register: jest.fn(),
registerItems: jest.fn(),
registerContainer: jest.fn(),
getDisplayColumns: jest.fn(arr),
focusInput: jest.fn(),
mixins: {
enterKeyHandler: {
onEnter: jest.fn(),
},
},
},
log: {
info: jest.fn(),
error: jest.fn(),
},
styling: {
registerContainer: jest.fn(),
getClasses: jest.fn(arr),
},
model: {
getChildren: jest.fn(arr),
getComponent: jest.fn(obj),
getContainer: jest.fn(() => ({
containerType: 'xxx',
})),
getAttributes: jest.fn(obj),
getDefaultNavigationId: jest.fn(str),
getInvokeType: jest.fn(str),
getOutcomes: jest.fn(),
getModal: jest.fn(),
getLabel: jest.fn(),
getNavigation: jest.fn(),
getOutcome: jest.fn(() => ({
attributes: {},
pageActionType: 'xxx',
})),
getNotifications: jest.fn(arr),
getHistory: jest.fn(arr),
getHistoricalNavigation: jest.fn(obj),
getMapElement: jest.fn(obj),
},
state: {
getComponent: jest.fn(),
setComponent: jest.fn(obj),
getComponents: jest.fn(obj),
},
utils: {
convertToArray: jest.fn(arr),
isNullOrWhitespace: jest.fn(),
isNullOrUndefined: jest.fn(t),
isNullOrEmpty: jest.fn(t),
isEqual: jest.fn(),
extractElement: jest.fn(),
removeLoadingIndicator: jest.fn(),
guid: jest.fn(str),
extend: jest.fn(),
},
tours: {
getTargetElement: jest.fn(() => ({
getBoundingClientRect: jest.fn(),
})),
},
settings: {
global: jest.fn(arr),
isDebugEnabled: jest.fn(f),
flow: jest.fn(),
},
social: {
getStream: jest.fn(),
},
formatting: {
toMomentFormat: jest.fn(str),
format: jest.fn(),
},
engine: {
objectDataRequest: jest.fn(),
fileDataRequest: jest.fn(),
navigate: jest.fn(),
},
};