not-node 6.5.26 → 6.5.28
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- package/src/exceptions/action.js +12 -0
- package/src/init/lib/app.js +12 -2
- package/src/manifest/batchRunner.js +2 -2
- package/src/manifest/initializator/forms.js +2 -5
- package/src/manifest/initializator/manifests.js +1 -4
- package/src/manifest/initializator/models.js +2 -4
- package/src/manifest/manifest.js +3 -4
- package/src/manifest/registrator/fields.js +40 -11
- package/src/manifest/registrator/fields.postponed.js +133 -0
- package/src/manifest/registrator/forms.js +3 -7
- package/src/manifest/registrator/locales.js +1 -5
- package/src/manifest/registrator/logics.js +4 -8
- package/src/manifest/registrator/models.js +4 -7
- package/src/manifest/registrator/routes.js +8 -12
- package/src/manifest/registrator/routes.ws.js +12 -15
- package/src/types.js +1 -0
- package/test/module/fields.js +8 -23
- package/test/module/locales.js +34 -38
- package/test/module/logics.js +209 -194
- package/test/module/models.js +143 -138
- package/test/module/routes.js +11 -35
- package/test/module/routes.ws.js +255 -240
package/test/module/models.js
CHANGED
|
@@ -1,140 +1,145 @@
|
|
|
1
|
-
const path = require(
|
|
2
|
-
const notModuleRegistratorModels = require(
|
|
3
|
-
|
|
4
|
-
module.exports = ({
|
|
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
|
-
|
|
1
|
+
const path = require("path");
|
|
2
|
+
const notModuleRegistratorModels = require("../../src/manifest/registrator/models");
|
|
3
|
+
|
|
4
|
+
module.exports = ({ expect }) => {
|
|
5
|
+
describe("notModuleRegistratorModels", () => {
|
|
6
|
+
describe("getPath", () => {
|
|
7
|
+
it("module paths(models)", function () {
|
|
8
|
+
const testPath = "path_to_models";
|
|
9
|
+
const ctx = {
|
|
10
|
+
module: {
|
|
11
|
+
paths: {
|
|
12
|
+
models: testPath,
|
|
13
|
+
},
|
|
14
|
+
},
|
|
15
|
+
};
|
|
16
|
+
const pathTo = notModuleRegistratorModels.getPath(ctx);
|
|
17
|
+
expect(pathTo).to.be.equal(testPath);
|
|
18
|
+
});
|
|
19
|
+
});
|
|
20
|
+
|
|
21
|
+
describe("run", function () {
|
|
22
|
+
const modelsPath = path.join(__dirname, "testies/module/models");
|
|
23
|
+
it("path to models is not defined", function () {
|
|
24
|
+
const ctx = {};
|
|
25
|
+
const param = {
|
|
26
|
+
nModule: {
|
|
27
|
+
module: {
|
|
28
|
+
paths: {
|
|
29
|
+
//models:modelsPath
|
|
30
|
+
},
|
|
31
|
+
},
|
|
32
|
+
},
|
|
33
|
+
};
|
|
34
|
+
const res = notModuleRegistratorModels.run.call(ctx, param);
|
|
35
|
+
expect(res).to.be.false;
|
|
36
|
+
});
|
|
37
|
+
|
|
38
|
+
it("paths to models is defined", function () {
|
|
39
|
+
let findAllCalled = false;
|
|
40
|
+
const ctx = {
|
|
41
|
+
findAll() {
|
|
42
|
+
findAllCalled = true;
|
|
43
|
+
},
|
|
44
|
+
};
|
|
45
|
+
const param = {
|
|
46
|
+
nModule: {
|
|
47
|
+
module: {
|
|
48
|
+
paths: {
|
|
49
|
+
models: modelsPath,
|
|
50
|
+
},
|
|
51
|
+
},
|
|
52
|
+
},
|
|
53
|
+
};
|
|
54
|
+
const res = notModuleRegistratorModels.run.call(ctx, param);
|
|
55
|
+
expect(res).to.be.true;
|
|
56
|
+
expect(findAllCalled).to.be.true;
|
|
57
|
+
});
|
|
58
|
+
});
|
|
59
|
+
|
|
60
|
+
describe("extend", function () {
|
|
61
|
+
it("notApp exists", function () {
|
|
62
|
+
const model = {
|
|
63
|
+
filename: "filename",
|
|
64
|
+
};
|
|
65
|
+
const ctx = {};
|
|
66
|
+
const param = {
|
|
67
|
+
model,
|
|
68
|
+
modelName: "",
|
|
69
|
+
fromPath: "",
|
|
70
|
+
nModule: {
|
|
71
|
+
appIsSet() {
|
|
72
|
+
return true;
|
|
73
|
+
},
|
|
74
|
+
getApp() {
|
|
75
|
+
return {
|
|
76
|
+
getModel() {},
|
|
77
|
+
getModelFile() {},
|
|
78
|
+
getModelSchema() {},
|
|
79
|
+
getModule() {},
|
|
80
|
+
};
|
|
81
|
+
},
|
|
82
|
+
},
|
|
83
|
+
};
|
|
84
|
+
notModuleRegistratorModels.extend.call(ctx, param);
|
|
85
|
+
|
|
86
|
+
expect(typeof model.getModel).to.be.equal("function");
|
|
87
|
+
expect(typeof model.getModelFile).to.be.equal("function");
|
|
88
|
+
expect(typeof model.getModelSchema).to.be.equal("function");
|
|
89
|
+
expect(typeof model.getModule).to.be.equal("function");
|
|
90
|
+
|
|
91
|
+
expect(typeof model.log.log).to.be.equal("function");
|
|
92
|
+
expect(typeof model.log.error).to.be.equal("function");
|
|
93
|
+
expect(typeof model.log.debug).to.be.equal("function");
|
|
94
|
+
|
|
95
|
+
expect(model).to.have.keys([
|
|
96
|
+
"getThisModule",
|
|
97
|
+
"filename",
|
|
98
|
+
"log",
|
|
99
|
+
"getModel",
|
|
100
|
+
"getModelFile",
|
|
101
|
+
"getModelSchema",
|
|
102
|
+
"getModule",
|
|
103
|
+
]);
|
|
104
|
+
expect(model.getThisModule()).to.be.deep.equal(param.nModule);
|
|
105
|
+
});
|
|
106
|
+
|
|
107
|
+
it("notApp doesnt exists", function () {
|
|
108
|
+
const model = {
|
|
109
|
+
filename: "filename",
|
|
110
|
+
};
|
|
111
|
+
const ctx = {};
|
|
112
|
+
const param = {
|
|
113
|
+
model,
|
|
114
|
+
modelName: "",
|
|
115
|
+
fromPath: "",
|
|
116
|
+
nModule: {
|
|
117
|
+
appIsSet() {
|
|
118
|
+
return false;
|
|
119
|
+
},
|
|
120
|
+
getApp() {
|
|
121
|
+
return {
|
|
122
|
+
getModel() {},
|
|
123
|
+
getModelFile() {},
|
|
124
|
+
getModelSchema() {},
|
|
125
|
+
getModule() {},
|
|
126
|
+
};
|
|
127
|
+
},
|
|
128
|
+
},
|
|
129
|
+
};
|
|
130
|
+
notModuleRegistratorModels.extend.call(ctx, param);
|
|
131
|
+
|
|
132
|
+
expect(typeof model.log.log).to.be.equal("function");
|
|
133
|
+
expect(typeof model.log.error).to.be.equal("function");
|
|
134
|
+
expect(typeof model.log.debug).to.be.equal("function");
|
|
135
|
+
|
|
136
|
+
expect(model).to.have.keys([
|
|
137
|
+
"getThisModule",
|
|
138
|
+
"filename",
|
|
139
|
+
"log",
|
|
140
|
+
]);
|
|
141
|
+
expect(model.getThisModule()).to.be.deep.equal(param.nModule);
|
|
142
|
+
});
|
|
143
|
+
});
|
|
62
144
|
});
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
describe('extend', function() {
|
|
66
|
-
it('notApp exists', function() {
|
|
67
|
-
const model = {
|
|
68
|
-
filename: 'filename'
|
|
69
|
-
};
|
|
70
|
-
const ctx = {};
|
|
71
|
-
const param = {
|
|
72
|
-
model,
|
|
73
|
-
modelName: '',
|
|
74
|
-
fromPath: '',
|
|
75
|
-
nModule: {
|
|
76
|
-
appIsSet(){return true;},
|
|
77
|
-
getApp(){
|
|
78
|
-
return {
|
|
79
|
-
getModel(){},
|
|
80
|
-
getModelFile(){},
|
|
81
|
-
getModelSchema(){},
|
|
82
|
-
getModule(){},
|
|
83
|
-
};
|
|
84
|
-
}
|
|
85
|
-
}
|
|
86
|
-
};
|
|
87
|
-
notModuleRegistratorModels.prototype.extend.call(ctx, param);
|
|
88
|
-
|
|
89
|
-
expect(typeof model.getModel).to.be.equal('function');
|
|
90
|
-
expect(typeof model.getModelFile).to.be.equal('function');
|
|
91
|
-
expect(typeof model.getModelSchema).to.be.equal('function');
|
|
92
|
-
expect(typeof model.getModule).to.be.equal('function');
|
|
93
|
-
|
|
94
|
-
expect(typeof model.log.log).to.be.equal('function');
|
|
95
|
-
expect(typeof model.log.error).to.be.equal('function');
|
|
96
|
-
expect(typeof model.log.debug).to.be.equal('function');
|
|
97
|
-
|
|
98
|
-
expect(model).to.have.keys(['getThisModule', 'filename', 'log', 'getModel', 'getModelFile', 'getModelSchema', 'getModule']);
|
|
99
|
-
expect(model.getThisModule()).to.be.deep.equal(param.nModule);
|
|
100
|
-
});
|
|
101
|
-
|
|
102
|
-
it('notApp doesnt exists', function() {
|
|
103
|
-
const model = {
|
|
104
|
-
filename: 'filename'
|
|
105
|
-
};
|
|
106
|
-
const ctx = {};
|
|
107
|
-
const param = {
|
|
108
|
-
model,
|
|
109
|
-
modelName: '',
|
|
110
|
-
fromPath: '',
|
|
111
|
-
nModule: {
|
|
112
|
-
appIsSet(){return false;},
|
|
113
|
-
getApp(){
|
|
114
|
-
return {
|
|
115
|
-
getModel(){},
|
|
116
|
-
getModelFile(){},
|
|
117
|
-
getModelSchema(){},
|
|
118
|
-
getModule(){},
|
|
119
|
-
};
|
|
120
|
-
}
|
|
121
|
-
}
|
|
122
|
-
};
|
|
123
|
-
notModuleRegistratorModels.prototype.extend.call(ctx, param);
|
|
124
|
-
|
|
125
|
-
expect(typeof model.log.log).to.be.equal('function');
|
|
126
|
-
expect(typeof model.log.error).to.be.equal('function');
|
|
127
|
-
expect(typeof model.log.debug).to.be.equal('function');
|
|
128
|
-
|
|
129
|
-
expect(model).to.have.keys(['getThisModule', 'filename', 'log']);
|
|
130
|
-
expect(model.getThisModule()).to.be.deep.equal(param.nModule);
|
|
131
|
-
});
|
|
132
|
-
});
|
|
133
|
-
|
|
134
|
-
});
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
145
|
};
|
package/test/module/routes.js
CHANGED
|
@@ -29,10 +29,7 @@ module.exports = ({ expect }) => {
|
|
|
29
29
|
module: { paths: {} },
|
|
30
30
|
},
|
|
31
31
|
};
|
|
32
|
-
const res = notModuleRegistratorRoutes.
|
|
33
|
-
ctx,
|
|
34
|
-
param
|
|
35
|
-
);
|
|
32
|
+
const res = notModuleRegistratorRoutes.run.call(ctx, param);
|
|
36
33
|
expect(res).to.be.false;
|
|
37
34
|
});
|
|
38
35
|
|
|
@@ -45,10 +42,7 @@ module.exports = ({ expect }) => {
|
|
|
45
42
|
module: { paths: { routes: "path_to_routes" } },
|
|
46
43
|
},
|
|
47
44
|
};
|
|
48
|
-
const res = notModuleRegistratorRoutes.
|
|
49
|
-
ctx,
|
|
50
|
-
param
|
|
51
|
-
);
|
|
45
|
+
const res = notModuleRegistratorRoutes.run.call(ctx, param);
|
|
52
46
|
expect(res).to.be.true;
|
|
53
47
|
});
|
|
54
48
|
});
|
|
@@ -91,10 +85,7 @@ module.exports = ({ expect }) => {
|
|
|
91
85
|
srcDir: routesPath,
|
|
92
86
|
file: "mangle.manifest.js",
|
|
93
87
|
};
|
|
94
|
-
const res = notModuleRegistratorRoutes.
|
|
95
|
-
ctx,
|
|
96
|
-
param
|
|
97
|
-
);
|
|
88
|
+
const res = notModuleRegistratorRoutes.findOne.call(ctx, param);
|
|
98
89
|
expect(res).to.be.false;
|
|
99
90
|
});
|
|
100
91
|
|
|
@@ -105,10 +96,7 @@ module.exports = ({ expect }) => {
|
|
|
105
96
|
srcDir: routesPath,
|
|
106
97
|
file: "jingle.manifest.js",
|
|
107
98
|
};
|
|
108
|
-
const res = notModuleRegistratorRoutes.
|
|
109
|
-
ctx,
|
|
110
|
-
param
|
|
111
|
-
);
|
|
99
|
+
const res = notModuleRegistratorRoutes.findOne.call(ctx, param);
|
|
112
100
|
expect(res).to.be.false;
|
|
113
101
|
});
|
|
114
102
|
|
|
@@ -119,10 +107,7 @@ module.exports = ({ expect }) => {
|
|
|
119
107
|
srcDir: routesPath,
|
|
120
108
|
file: "icon.manifest.js",
|
|
121
109
|
};
|
|
122
|
-
const res = notModuleRegistratorRoutes.
|
|
123
|
-
ctx,
|
|
124
|
-
param
|
|
125
|
-
);
|
|
110
|
+
const res = notModuleRegistratorRoutes.findOne.call(ctx, param);
|
|
126
111
|
expect(res).to.be.false;
|
|
127
112
|
});
|
|
128
113
|
|
|
@@ -142,10 +127,7 @@ module.exports = ({ expect }) => {
|
|
|
142
127
|
srcDir: routesPath,
|
|
143
128
|
file: "logo.manifest.js",
|
|
144
129
|
};
|
|
145
|
-
const res = notModuleRegistratorRoutes.
|
|
146
|
-
ctx,
|
|
147
|
-
param
|
|
148
|
-
);
|
|
130
|
+
const res = notModuleRegistratorRoutes.findOne.call(ctx, param);
|
|
149
131
|
expect(res).to.be.true;
|
|
150
132
|
});
|
|
151
133
|
});
|
|
@@ -153,7 +135,7 @@ module.exports = ({ expect }) => {
|
|
|
153
135
|
describe("registerManifestAndRoutes", function () {
|
|
154
136
|
it("route not exists, ws end-points exists", function () {
|
|
155
137
|
let i = 0;
|
|
156
|
-
notModuleRegistratorRoutes.
|
|
138
|
+
notModuleRegistratorRoutes.registerManifestAndRoutes.call(
|
|
157
139
|
{
|
|
158
140
|
registerRoute() {
|
|
159
141
|
i++;
|
|
@@ -175,7 +157,7 @@ module.exports = ({ expect }) => {
|
|
|
175
157
|
|
|
176
158
|
it("route exists, ws end-points not exists", function () {
|
|
177
159
|
let i = 0;
|
|
178
|
-
notModuleRegistratorRoutes.
|
|
160
|
+
notModuleRegistratorRoutes.registerManifestAndRoutes.call(
|
|
179
161
|
{
|
|
180
162
|
registerRoute() {
|
|
181
163
|
i++;
|
|
@@ -197,7 +179,7 @@ module.exports = ({ expect }) => {
|
|
|
197
179
|
|
|
198
180
|
it("route exists, ws end-points exists", function () {
|
|
199
181
|
let i = 0;
|
|
200
|
-
notModuleRegistratorRoutes.
|
|
182
|
+
notModuleRegistratorRoutes.registerManifestAndRoutes.call(
|
|
201
183
|
{
|
|
202
184
|
registerRoute() {
|
|
203
185
|
i++;
|
|
@@ -249,10 +231,7 @@ module.exports = ({ expect }) => {
|
|
|
249
231
|
},
|
|
250
232
|
},
|
|
251
233
|
};
|
|
252
|
-
notModuleRegistratorRoutes.
|
|
253
|
-
ctx,
|
|
254
|
-
param
|
|
255
|
-
);
|
|
234
|
+
notModuleRegistratorRoutes.registerRoute.call(ctx, param);
|
|
256
235
|
expect(typeof route.getLogic).to.be.equal("function");
|
|
257
236
|
expect(typeof route.getLogicFile).to.be.equal("function");
|
|
258
237
|
expect(typeof route.getModel).to.be.equal("function");
|
|
@@ -308,10 +287,7 @@ module.exports = ({ expect }) => {
|
|
|
308
287
|
},
|
|
309
288
|
},
|
|
310
289
|
};
|
|
311
|
-
notModuleRegistratorRoutes.
|
|
312
|
-
ctx,
|
|
313
|
-
param
|
|
314
|
-
);
|
|
290
|
+
notModuleRegistratorRoutes.registerRoute.call(ctx, param);
|
|
315
291
|
|
|
316
292
|
expect(typeof route.log.log).to.be.equal("function");
|
|
317
293
|
expect(typeof route.log.error).to.be.equal("function");
|