Repository navigation
Expand file tree
/
Copy pathjest.setup.ts
More file actions
234 lines (189 loc) · 6.57 KB
/
Copy pathjest.setup.ts
File metadata and controls
234 lines (189 loc) · 6.57 KB
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
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
// @ts-nocheck
jest.mock('@nativescript/core/application', () => null, { virtual: true });
global.__DEV__ = true;
global.__ANDROID__ = false;
global.__IOS__ = true;
global.__VISIONOS__ = true;
global.WeakRef.prototype.get = global.WeakRef.prototype.deref;
global.NativeClass = function () {};
global.NSTimer = class NSTimer {};
global.NSObject = class NSObject {
static new() {
return new NSObject();
}
};
global.NSString = {
stringWithString() {
return {
intValue: 13,
};
},
pathWithComponents(components: string[] | NSArray<string>) {
return {
stringByStandardizingPath: '',
};
},
};
// global.NSObject = class NSObject {};
global.NSFileManager = {
defaultManager: {
fileExistsAtPathIsDirectory(path: string, isDirectory?: boolean) {
return true;
},
},
};
global.NSNotificationCenter = {
defaultCenter: {
addObserverSelectorNameObject(observer: any, selector: any, name: any, object: any) {},
},
};
global.interop = {
Reference: class Reference {
constructor(type: any, ref?: boolean) {}
},
types: {
bool: {},
},
};
// global.UIApplication = {
// }
global.UIDevice = {
currentDevice: {
systemVersion: '13.0',
},
};
global.UIScreen = {
mainScreen: {
scale: 1,
},
};
const cgColors = { CGColor: 1 };
global.UIColor = {
alloc() {
return {
initWithRedGreenBlueAlpha(r, g, b, a) {
return {};
},
};
},
clearColor: cgColors,
};
global.NSSearchPathDirectory = {
LibraryDirectory: '',
DeveloperDirectory: '',
DesktopDirectory: '',
DownloadsDirectory: '',
};
global.NativeScriptUtils = {
createUIFont(descriptor: any) {
return {};
},
};
global.NSOperationQueue = {
mainQueue: {
addOperationWithBlock(fn: Function) {
if (fn) {
fn();
}
},
},
};
global.NSThread = {
isMainThread: true,
};
global.CFRunLoopGetMain = function () {
return {};
};
global.kCFRunLoopDefaultMode = 1;
global.CFRunLoopPerformBlock = function (runloop, kCFRunLoopDefaultMode, func) {};
global.CFRunLoopWakeUp = function (runloop) {};
global.NativeScriptGlobals = {
events: {
on: (args) => {},
once: (args) => {},
off: (args) => {},
notify: (args) => {},
hasListeners: (args) => {},
},
};
global.CADisplayLink = function () {};
global.NSNotification = function () {};
global.UIApplicationDelegate = function () {};
global.UIApplicationDidFinishLaunchingNotification = 'UIApplicationDidFinishLaunchingNotification';
global.UIApplicationDidBecomeActiveNotification = 'UIApplicationDidBecomeActiveNotification';
global.UIApplicationDidEnterBackgroundNotification = 'UIApplicationDidEnterBackgroundNotification';
global.UIApplicationWillTerminateNotification = 'UIApplicationWillTerminateNotification';
global.UIApplicationDidReceiveMemoryWarningNotification = 'UIApplicationDidReceiveMemoryWarningNotification';
global.UIApplicationDidChangeStatusBarOrientationNotification = 'UIApplicationDidChangeStatusBarOrientationNotification';
global.UIResponder = function () {};
global.UIResponder.extend = function () {};
global.UIViewController = function () {};
global.UIViewControllerTransitioningDelegate = function () {};
global.UIGestureRecognizer = function () {};
global.UIGestureRecognizerDelegate = function () {};
global.UIAdaptivePresentationControllerDelegate = function () {};
global.UIPopoverPresentationControllerDelegate = function () {};
global.UIContentSizeCategoryExtraSmall = 0.5;
global.UIContentSizeCategorySmall = 0.7;
global.UIContentSizeCategoryMedium = 0.85;
global.UIContentSizeCategoryLarge = 1;
global.UIContentSizeCategoryExtraLarge = 1.15;
global.UIContentSizeCategoryExtraExtraLarge = 1.3;
global.UIContentSizeCategoryExtraExtraExtraLarge = 1.5;
global.UIContentSizeCategoryAccessibilityMedium = 2;
global.UIContentSizeCategoryAccessibilityLarge = 2.5;
global.UIContentSizeCategoryAccessibilityExtraLarge = 3;
global.UIContentSizeCategoryAccessibilityExtraExtraLarge = 3.5;
global.UIContentSizeCategoryAccessibilityExtraExtraExtraLarge = 4;
// global.UIDocumentInteractionController = {
// interactionControllerWithURL(url: any) {
// return null;
// },
// };
// global.NSURL = {
// fileURLWithPath(path: string) {
// return null;
// },
// };
// declare class UIDocumentInteractionController extends NSObject implements UIActionSheetDelegate {
// static alloc(): UIDocumentInteractionController; // inherited from NSObject
// static interactionControllerWithURL(url: NSURL): UIDocumentInteractionController;
// static new(): UIDocumentInteractionController; // inherited from NSObject
// URL: NSURL;
// UTI: string;
// annotation: any;
// delegate: UIDocumentInteractionControllerDelegate;
// readonly gestureRecognizers: NSArray<UIGestureRecognizer>;
// readonly icons: NSArray<UIImage>;
// name: string;
// readonly debugDescription: string; // inherited from NSObjectProtocol
// readonly description: string; // inherited from NSObjectProtocol
// readonly hash: number; // inherited from NSObjectProtocol
// readonly isProxy: boolean; // inherited from NSObjectProtocol
// readonly superclass: typeof NSObject; // inherited from NSObjectProtocol
// readonly // inherited from NSObjectProtocol
// actionSheetCancel(actionSheet: UIActionSheet): void;
// actionSheetClickedButtonAtIndex(actionSheet: UIActionSheet, buttonIndex: number): void;
// actionSheetDidDismissWithButtonIndex(actionSheet: UIActionSheet, buttonIndex: number): void;
// actionSheetWillDismissWithButtonIndex(actionSheet: UIActionSheet, buttonIndex: number): void;
// class(): typeof NSObject;
// conformsToProtocol(aProtocol: any /* Protocol */): boolean;
// didPresentActionSheet(actionSheet: UIActionSheet): void;
// dismissMenuAnimated(animated: boolean): void;
// dismissPreviewAnimated(animated: boolean): void;
// isEqual(object: any): boolean;
// isKindOfClass(aClass: typeof NSObject): boolean;
// isMemberOfClass(aClass: typeof NSObject): boolean;
// performSelector(aSelector: string): any;
// performSelectorWithObject(aSelector: string, object: any): any;
// performSelectorWithObjectWithObject(aSelector: string, object1: any, object2: any): any;
// presentOpenInMenuFromBarButtonItemAnimated(item: UIBarButtonItem, animated: boolean): boolean;
// presentOpenInMenuFromRectInViewAnimated(rect: CGRect, view: UIView, animated: boolean): boolean;
// presentOptionsMenuFromBarButtonItemAnimated(item: UIBarButtonItem, animated: boolean): boolean;
// presentOptionsMenuFromRectInViewAnimated(rect: CGRect, view: UIView, animated: boolean): boolean;
// presentPreviewAnimated(animated: boolean): boolean;
// respondsToSelector(aSelector: string): boolean;
// retainCount(): number;
// self(): this;
// willPresentActionSheet(actionSheet: UIActionSheet): void;
// }