-
-
Notifications
You must be signed in to change notification settings - Fork 1
/
mocha-start.js
54 lines (47 loc) · 1.38 KB
/
mocha-start.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
(function JBXMochaWrap() {
if (process.env.OLSK_SPEC_MOCHA_INTERFACE === 'true') {
return;
}
before(async function() {
global.ZDRTestingWrap = await require('zerodatawrap').ZDRWrap({
ZDRParamLibrary: require('remotestoragejs'),
ZDRParamScopes: [{
ZDRScopeKey: 'App',
ZDRScopeDirectory: 'joybox',
ZDRScopeSchemas: [
require('./os-app/_shared/JBXDocument/main.js').default,
require('./os-app/_shared/JBXSetting/main.js').default,
require('./os-app/_shared/JBXTransport/main.js').default,
],
}],
_ZDRParamDispatchJSONPreStringify: require('OLSKObject').OLSKObjectSafeCopy,
});
});
beforeEach(function() {
return ZDRTestingWrap.App.ZDRStorageDeleteFolderRecursive('');
});
})();
(function JBXMochaStubs() {
Object.entries({
StubDocumentObject(inputData) {
return Object.assign({
JBXDocumentNotes: Math.random().toString(),
}, inputData);
},
StubDocumentObjectValid(inputData) {
return StubDocumentObject(Object.assign({
JBXDocumentID: Math.random().toString(),
JBXDocumentCreationDate: new Date(),
JBXDocumentModificationDate: new Date(),
}, inputData));
},
StubSettingObjectValid (inputData = {}) {
return Object.assign({
JBXSettingKey: Math.random().toString(),
JBXSettingValue: Math.random().toString(),
}, inputData);
},
}).map(function (e) {
return global[e.shift()] = e.pop();
});
})();