not-node 6.5.27 → 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/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/routes.ws.js
CHANGED
|
@@ -1,255 +1,270 @@
|
|
|
1
|
-
const path = require(
|
|
2
|
-
const notModuleRegistratorRoutesWS = require(
|
|
1
|
+
const path = require("path");
|
|
2
|
+
const notModuleRegistratorRoutesWS = require("../../src/manifest/registrator/routes.ws");
|
|
3
3
|
|
|
4
|
-
module.exports = ({
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
4
|
+
module.exports = ({ expect }) => {
|
|
5
|
+
describe("notModuleRegistratorRoutesWS", function () {
|
|
6
|
+
describe("run", function () {
|
|
7
|
+
it("notApp exists", function () {
|
|
8
|
+
const res = [];
|
|
9
|
+
const ctx = {
|
|
10
|
+
registerServers() {
|
|
11
|
+
res.push("servers");
|
|
12
|
+
},
|
|
13
|
+
registerClients() {
|
|
14
|
+
res.push("clients");
|
|
15
|
+
},
|
|
16
|
+
};
|
|
17
|
+
const nModule = {
|
|
18
|
+
appIsSet() {
|
|
19
|
+
return true;
|
|
20
|
+
},
|
|
21
|
+
};
|
|
22
|
+
notModuleRegistratorRoutesWS.run.call(ctx, {
|
|
23
|
+
nModule,
|
|
24
|
+
wsRoute: {},
|
|
25
|
+
wsRouteName: "wsRouteName",
|
|
26
|
+
});
|
|
27
|
+
expect(res.sort()).to.be.deep.equal(
|
|
28
|
+
["servers", "clients"].sort()
|
|
29
|
+
);
|
|
30
|
+
});
|
|
9
31
|
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
32
|
+
it("notApp doesnt exists", function () {
|
|
33
|
+
const res = [];
|
|
34
|
+
const ctx = {
|
|
35
|
+
registerServers() {
|
|
36
|
+
res.push("servers");
|
|
37
|
+
},
|
|
38
|
+
registerClients() {
|
|
39
|
+
res.push("clients");
|
|
40
|
+
},
|
|
41
|
+
};
|
|
42
|
+
const nModule = {
|
|
43
|
+
appIsSet() {
|
|
44
|
+
return false;
|
|
45
|
+
},
|
|
46
|
+
};
|
|
47
|
+
notModuleRegistratorRoutesWS.run.call(ctx, {
|
|
48
|
+
nModule,
|
|
49
|
+
wsRoute: {},
|
|
50
|
+
wsRouteName: "wsRouteName",
|
|
51
|
+
});
|
|
52
|
+
expect(res).to.be.deep.equal([]);
|
|
53
|
+
});
|
|
29
54
|
});
|
|
30
|
-
expect(res.sort()).to.be.deep.equal(['servers', 'clients'].sort());
|
|
31
|
-
});
|
|
32
55
|
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
notModuleRegistratorRoutesWS.prototype.run.call(ctx, {
|
|
49
|
-
nModule,
|
|
50
|
-
wsRoute: {},
|
|
51
|
-
wsRouteName: 'wsRouteName'
|
|
56
|
+
describe("registerClients", function () {
|
|
57
|
+
it("plain run", function (done) {
|
|
58
|
+
const ctx = {
|
|
59
|
+
registerCollectionType({ collectionType }) {
|
|
60
|
+
expect(collectionType).to.be.equal("clients");
|
|
61
|
+
done();
|
|
62
|
+
},
|
|
63
|
+
};
|
|
64
|
+
const nModule = {};
|
|
65
|
+
notModuleRegistratorRoutesWS.registerClients.call(ctx, {
|
|
66
|
+
nModule,
|
|
67
|
+
wsRoute: {},
|
|
68
|
+
wsRouteName: "wsRouteName",
|
|
69
|
+
});
|
|
70
|
+
});
|
|
52
71
|
});
|
|
53
|
-
expect(res).to.be.deep.equal([]);
|
|
54
|
-
});
|
|
55
72
|
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
wsRoute: {},
|
|
72
|
-
wsRouteName: 'wsRouteName'
|
|
73
|
+
describe("registerServers", function () {
|
|
74
|
+
it("plain run", function (done) {
|
|
75
|
+
const ctx = {
|
|
76
|
+
registerCollectionType({ collectionType }) {
|
|
77
|
+
expect(collectionType).to.be.equal("servers");
|
|
78
|
+
done();
|
|
79
|
+
},
|
|
80
|
+
};
|
|
81
|
+
const nModule = {};
|
|
82
|
+
notModuleRegistratorRoutesWS.registerServers.call(ctx, {
|
|
83
|
+
nModule,
|
|
84
|
+
wsRoute: {},
|
|
85
|
+
wsRouteName: "wsRouteName",
|
|
86
|
+
});
|
|
87
|
+
});
|
|
73
88
|
});
|
|
74
|
-
});
|
|
75
|
-
|
|
76
|
-
});
|
|
77
89
|
|
|
90
|
+
describe("registerCollectionType", function () {
|
|
91
|
+
it("collectionType exists", function (done) {
|
|
92
|
+
const ctx = {
|
|
93
|
+
registerCollectionItem({
|
|
94
|
+
nModule,
|
|
95
|
+
wsRoute,
|
|
96
|
+
wsRouteName,
|
|
97
|
+
collectionType,
|
|
98
|
+
collectionName,
|
|
99
|
+
}) {
|
|
100
|
+
expect(collectionType).to.be.equal("servers");
|
|
101
|
+
expect(collectionName).to.be.equal("main");
|
|
102
|
+
done();
|
|
103
|
+
},
|
|
104
|
+
};
|
|
105
|
+
const param = {
|
|
106
|
+
nModule: {},
|
|
107
|
+
wsRoute: {
|
|
108
|
+
servers: {
|
|
109
|
+
main: {},
|
|
110
|
+
},
|
|
111
|
+
},
|
|
112
|
+
wsRouteName: "wsRouteName",
|
|
113
|
+
collectionType: "servers",
|
|
114
|
+
};
|
|
115
|
+
notModuleRegistratorRoutesWS.registerCollectionType.call(
|
|
116
|
+
ctx,
|
|
117
|
+
param
|
|
118
|
+
);
|
|
119
|
+
});
|
|
78
120
|
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
121
|
+
it("collectionType doesnt exists", function () {
|
|
122
|
+
const ctx = {};
|
|
123
|
+
const param = {
|
|
124
|
+
nModule: {},
|
|
125
|
+
wsRoute: {},
|
|
126
|
+
wsRouteName: "wsRouteName",
|
|
127
|
+
collectionType: "servers",
|
|
128
|
+
};
|
|
129
|
+
const res =
|
|
130
|
+
notModuleRegistratorRoutesWS.registerCollectionType.call(
|
|
131
|
+
ctx,
|
|
132
|
+
param
|
|
133
|
+
);
|
|
134
|
+
expect(res).to.be.false;
|
|
135
|
+
});
|
|
92
136
|
});
|
|
93
|
-
});
|
|
94
|
-
});
|
|
95
|
-
|
|
96
|
-
describe('registerCollectionType', function() {
|
|
97
|
-
it('collectionType exists', function(done) {
|
|
98
|
-
const ctx = {
|
|
99
|
-
registerCollectionItem({
|
|
100
|
-
nModule,
|
|
101
|
-
wsRoute, wsRouteName,
|
|
102
|
-
collectionType, collectionName
|
|
103
|
-
}){
|
|
104
|
-
expect(collectionType).to.be.equal('servers');
|
|
105
|
-
expect(collectionName).to.be.equal('main');
|
|
106
|
-
done();
|
|
107
|
-
}
|
|
108
|
-
};
|
|
109
|
-
const param = {
|
|
110
|
-
nModule: {},
|
|
111
|
-
wsRoute: {
|
|
112
|
-
servers:{
|
|
113
|
-
main:{
|
|
114
|
-
|
|
115
|
-
}
|
|
116
|
-
}
|
|
117
|
-
}, wsRouteName: 'wsRouteName',
|
|
118
|
-
collectionType: 'servers'
|
|
119
|
-
};
|
|
120
|
-
notModuleRegistratorRoutesWS.prototype.registerCollectionType.call(ctx, param);
|
|
121
|
-
});
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
it('collectionType doesnt exists', function() {
|
|
125
|
-
const ctx = {};
|
|
126
|
-
const param = {
|
|
127
|
-
nModule: {},
|
|
128
|
-
wsRoute: {}, wsRouteName: 'wsRouteName',
|
|
129
|
-
collectionType: 'servers'
|
|
130
|
-
};
|
|
131
|
-
const res = notModuleRegistratorRoutesWS.prototype.registerCollectionType.call(ctx, param);
|
|
132
|
-
expect(res).to.be.false;
|
|
133
|
-
});
|
|
134
|
-
});
|
|
135
137
|
|
|
138
|
+
describe("registerCollectionItem", function () {
|
|
139
|
+
it("registerCollectionItem exists", function (done) {
|
|
140
|
+
const ctx = {
|
|
141
|
+
registerEndPoints({
|
|
142
|
+
nModule,
|
|
143
|
+
wsRoute,
|
|
144
|
+
wsRouteName,
|
|
145
|
+
collectionType,
|
|
146
|
+
collectionName,
|
|
147
|
+
collection,
|
|
148
|
+
}) {
|
|
149
|
+
expect(collectionType).to.be.equal("servers");
|
|
150
|
+
expect(collectionName).to.be.equal("main");
|
|
151
|
+
expect(typeof collection.getLogic).to.be.equal(
|
|
152
|
+
"function"
|
|
153
|
+
);
|
|
154
|
+
expect(typeof collection.getLogicFile).to.be.equal(
|
|
155
|
+
"function"
|
|
156
|
+
);
|
|
157
|
+
expect(typeof collection.getModel).to.be.equal(
|
|
158
|
+
"function"
|
|
159
|
+
);
|
|
160
|
+
expect(typeof collection.getModelFile).to.be.equal(
|
|
161
|
+
"function"
|
|
162
|
+
);
|
|
163
|
+
expect(typeof collection.getModelSchema).to.be.equal(
|
|
164
|
+
"function"
|
|
165
|
+
);
|
|
166
|
+
expect(typeof collection.getModule).to.be.equal(
|
|
167
|
+
"function"
|
|
168
|
+
);
|
|
169
|
+
done();
|
|
170
|
+
},
|
|
171
|
+
};
|
|
172
|
+
const param = {
|
|
173
|
+
nModule: {
|
|
174
|
+
getApp() {
|
|
175
|
+
return {
|
|
176
|
+
getModel() {},
|
|
177
|
+
getModelFile() {},
|
|
178
|
+
getModelSchema() {},
|
|
179
|
+
getLogic() {},
|
|
180
|
+
getLogicFile() {},
|
|
181
|
+
getModule() {},
|
|
182
|
+
};
|
|
183
|
+
},
|
|
184
|
+
},
|
|
185
|
+
wsRoute: {
|
|
186
|
+
servers: {
|
|
187
|
+
main: {},
|
|
188
|
+
},
|
|
189
|
+
},
|
|
190
|
+
wsRouteName: "wsRouteName",
|
|
191
|
+
collectionType: "servers",
|
|
192
|
+
collectionName: "main",
|
|
193
|
+
};
|
|
194
|
+
notModuleRegistratorRoutesWS.registerCollectionItem.call(
|
|
195
|
+
ctx,
|
|
196
|
+
param
|
|
197
|
+
);
|
|
198
|
+
});
|
|
199
|
+
});
|
|
136
200
|
|
|
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
|
-
wsRoute: {
|
|
170
|
-
servers:{
|
|
171
|
-
main:{}
|
|
172
|
-
}
|
|
173
|
-
}, wsRouteName: 'wsRouteName',
|
|
174
|
-
collectionType: 'servers',
|
|
175
|
-
collectionName: 'main'
|
|
176
|
-
};
|
|
177
|
-
notModuleRegistratorRoutesWS.prototype.registerCollectionItem.call(ctx, param);
|
|
178
|
-
});
|
|
179
|
-
|
|
180
|
-
});
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
describe('addEntityEndPointsOfType', function() {
|
|
184
|
-
it('no exceptions', function(done) {
|
|
185
|
-
const param = {
|
|
186
|
-
nModule: {
|
|
187
|
-
setRouteWS({
|
|
188
|
-
collectionType,
|
|
189
|
-
collectionName,
|
|
190
|
-
endPointType,
|
|
191
|
-
wsRouteName,
|
|
192
|
-
action,
|
|
193
|
-
func
|
|
194
|
-
}) {
|
|
195
|
-
expect(typeof func).to.be.equal('function');
|
|
196
|
-
expect(action).to.be.equal('get');
|
|
197
|
-
expect(wsRouteName).to.be.equal('user');
|
|
198
|
-
expect(endPointType).to.be.equal('request');
|
|
199
|
-
expect(collectionName).to.be.equal('main');
|
|
200
|
-
expect(collectionType).to.be.equal('clients');
|
|
201
|
-
done();
|
|
202
|
-
}
|
|
203
|
-
},
|
|
204
|
-
endPoints: {
|
|
205
|
-
get() {}
|
|
206
|
-
},
|
|
207
|
-
collectionType: 'clients',
|
|
208
|
-
collectionName: 'main',
|
|
209
|
-
wsRouteName: 'user',
|
|
210
|
-
endPointType: 'request'
|
|
211
|
-
};
|
|
212
|
-
notModuleRegistratorRoutesWS.addEntityEndPointsOfType(param);
|
|
213
|
-
});
|
|
214
|
-
});
|
|
215
|
-
|
|
201
|
+
describe("addEntityEndPointsOfType", function () {
|
|
202
|
+
it("no exceptions", function (done) {
|
|
203
|
+
const param = {
|
|
204
|
+
nModule: {
|
|
205
|
+
setRouteWS({
|
|
206
|
+
collectionType,
|
|
207
|
+
collectionName,
|
|
208
|
+
endPointType,
|
|
209
|
+
wsRouteName,
|
|
210
|
+
action,
|
|
211
|
+
func,
|
|
212
|
+
}) {
|
|
213
|
+
expect(typeof func).to.be.equal("function");
|
|
214
|
+
expect(action).to.be.equal("get");
|
|
215
|
+
expect(wsRouteName).to.be.equal("user");
|
|
216
|
+
expect(endPointType).to.be.equal("request");
|
|
217
|
+
expect(collectionName).to.be.equal("main");
|
|
218
|
+
expect(collectionType).to.be.equal("clients");
|
|
219
|
+
done();
|
|
220
|
+
},
|
|
221
|
+
},
|
|
222
|
+
endPoints: {
|
|
223
|
+
get() {},
|
|
224
|
+
},
|
|
225
|
+
collectionType: "clients",
|
|
226
|
+
collectionName: "main",
|
|
227
|
+
wsRouteName: "user",
|
|
228
|
+
endPointType: "request",
|
|
229
|
+
};
|
|
230
|
+
notModuleRegistratorRoutesWS.addEntityEndPointsOfType(param);
|
|
231
|
+
});
|
|
232
|
+
});
|
|
216
233
|
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
234
|
+
describe("registerEndPoints", function () {
|
|
235
|
+
it("no exceptions", function (done) {
|
|
236
|
+
const param = {
|
|
237
|
+
nModule: {
|
|
238
|
+
createEmptyIfNotExistsRouteWSType() {},
|
|
239
|
+
setRouteWS({
|
|
240
|
+
collectionType,
|
|
241
|
+
collectionName,
|
|
242
|
+
endPointType,
|
|
243
|
+
wsRouteName,
|
|
244
|
+
action,
|
|
245
|
+
func,
|
|
246
|
+
}) {
|
|
247
|
+
expect(typeof func).to.be.equal("function");
|
|
248
|
+
expect(action).to.be.equal("get");
|
|
249
|
+
expect(wsRouteName).to.be.equal("user");
|
|
250
|
+
expect(endPointType).to.be.equal("request");
|
|
251
|
+
expect(collectionName).to.be.equal("main");
|
|
252
|
+
expect(collectionType).to.be.equal("clients");
|
|
253
|
+
done();
|
|
254
|
+
},
|
|
255
|
+
},
|
|
256
|
+
collection: {
|
|
257
|
+
request: {
|
|
258
|
+
get() {},
|
|
259
|
+
},
|
|
260
|
+
},
|
|
261
|
+
collectionType: "clients",
|
|
262
|
+
collectionName: "main",
|
|
263
|
+
wsRouteName: "user",
|
|
264
|
+
endPointType: "request",
|
|
265
|
+
};
|
|
266
|
+
notModuleRegistratorRoutesWS.registerEndPoints(param);
|
|
267
|
+
});
|
|
268
|
+
});
|
|
251
269
|
});
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
});
|
|
255
270
|
};
|