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/fields.js
CHANGED
|
@@ -20,10 +20,7 @@ module.exports = ({ expect }) => {
|
|
|
20
20
|
|
|
21
21
|
describe("run", function () {
|
|
22
22
|
it("path to fields is not defined", function () {
|
|
23
|
-
const ctx = {
|
|
24
|
-
findAll() {},
|
|
25
|
-
extendByFrontValidators() {},
|
|
26
|
-
};
|
|
23
|
+
const ctx = {};
|
|
27
24
|
const param = {
|
|
28
25
|
nModule: {
|
|
29
26
|
module: {
|
|
@@ -31,10 +28,7 @@ module.exports = ({ expect }) => {
|
|
|
31
28
|
},
|
|
32
29
|
},
|
|
33
30
|
};
|
|
34
|
-
const res = notModuleRegistratorFields.
|
|
35
|
-
ctx,
|
|
36
|
-
param
|
|
37
|
-
);
|
|
31
|
+
const res = notModuleRegistratorFields.run.call(ctx, param);
|
|
38
32
|
expect(res).to.be.false;
|
|
39
33
|
});
|
|
40
34
|
|
|
@@ -52,10 +46,7 @@ module.exports = ({ expect }) => {
|
|
|
52
46
|
},
|
|
53
47
|
},
|
|
54
48
|
};
|
|
55
|
-
const res = notModuleRegistratorFields.
|
|
56
|
-
ctx,
|
|
57
|
-
param
|
|
58
|
-
);
|
|
49
|
+
const res = notModuleRegistratorFields.run.call(ctx, param);
|
|
59
50
|
expect(res).to.be.true;
|
|
60
51
|
});
|
|
61
52
|
});
|
|
@@ -79,7 +70,7 @@ module.exports = ({ expect }) => {
|
|
|
79
70
|
nModule: {},
|
|
80
71
|
srcDir: logicsPath,
|
|
81
72
|
};
|
|
82
|
-
notModuleRegistratorFields.
|
|
73
|
+
notModuleRegistratorFields.findAll.call(ctx, param);
|
|
83
74
|
result.sort();
|
|
84
75
|
expect(result).to.be.deep.equal(list);
|
|
85
76
|
});
|
|
@@ -108,7 +99,7 @@ module.exports = ({ expect }) => {
|
|
|
108
99
|
},
|
|
109
100
|
fromPath: libPath,
|
|
110
101
|
};
|
|
111
|
-
notModuleRegistratorFields.
|
|
102
|
+
notModuleRegistratorFields.register.call(ctx, param);
|
|
112
103
|
});
|
|
113
104
|
|
|
114
105
|
it("file is single field", (done) => {
|
|
@@ -133,7 +124,7 @@ module.exports = ({ expect }) => {
|
|
|
133
124
|
"../testies/module/fields/single.js"
|
|
134
125
|
),
|
|
135
126
|
};
|
|
136
|
-
notModuleRegistratorFields.
|
|
127
|
+
notModuleRegistratorFields.register.call(ctx, param);
|
|
137
128
|
});
|
|
138
129
|
});
|
|
139
130
|
|
|
@@ -165,10 +156,7 @@ module.exports = ({ expect }) => {
|
|
|
165
156
|
"../testies/module/fields/collection.js"
|
|
166
157
|
)).FIELDS,
|
|
167
158
|
};
|
|
168
|
-
notModuleRegistratorFields.
|
|
169
|
-
ctx,
|
|
170
|
-
param
|
|
171
|
-
);
|
|
159
|
+
notModuleRegistratorFields.registerFields.call(ctx, param);
|
|
172
160
|
});
|
|
173
161
|
});
|
|
174
162
|
|
|
@@ -195,10 +183,7 @@ module.exports = ({ expect }) => {
|
|
|
195
183
|
},
|
|
196
184
|
},
|
|
197
185
|
};
|
|
198
|
-
notModuleRegistratorFields.
|
|
199
|
-
ctx,
|
|
200
|
-
param
|
|
201
|
-
);
|
|
186
|
+
notModuleRegistratorFields.registerField.call(ctx, param);
|
|
202
187
|
expect(Object.keys(FIELDS).includes("single")).to.be.true;
|
|
203
188
|
});
|
|
204
189
|
});
|
package/test/module/locales.js
CHANGED
|
@@ -1,42 +1,38 @@
|
|
|
1
|
-
const notModuleRegistratorLocales = require(
|
|
1
|
+
const notModuleRegistratorLocales = require("../../src/manifest/registrator/locales");
|
|
2
2
|
|
|
3
|
-
module.exports = ({
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
});
|
|
20
|
-
});
|
|
3
|
+
module.exports = ({ expect }) => {
|
|
4
|
+
describe("notModuleRegistratorLocales", () => {
|
|
5
|
+
describe("getPath", () => {
|
|
6
|
+
it("module paths(locales)", function () {
|
|
7
|
+
const testPath = "path_to_locales";
|
|
8
|
+
const ctx = {
|
|
9
|
+
module: {
|
|
10
|
+
paths: {
|
|
11
|
+
locales: testPath,
|
|
12
|
+
},
|
|
13
|
+
},
|
|
14
|
+
};
|
|
15
|
+
const pathTo = notModuleRegistratorLocales.getPath(ctx);
|
|
16
|
+
expect(pathTo).to.be.equal(testPath);
|
|
17
|
+
});
|
|
18
|
+
});
|
|
21
19
|
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
20
|
+
describe("run", () => {
|
|
21
|
+
it("path exists", function () {
|
|
22
|
+
const testPath = "path_to_locales";
|
|
23
|
+
const nModule = {
|
|
24
|
+
module: {
|
|
25
|
+
paths: {
|
|
26
|
+
locales: testPath,
|
|
27
|
+
},
|
|
28
|
+
},
|
|
29
|
+
getName() {
|
|
30
|
+
return "test";
|
|
31
|
+
},
|
|
32
|
+
};
|
|
33
|
+
const res = notModuleRegistratorLocales.run({ nModule });
|
|
34
|
+
expect(res).to.be.true;
|
|
35
|
+
});
|
|
36
|
+
});
|
|
39
37
|
});
|
|
40
|
-
|
|
41
|
-
});
|
|
42
38
|
};
|
package/test/module/logics.js
CHANGED
|
@@ -1,196 +1,211 @@
|
|
|
1
|
-
const path = require(
|
|
2
|
-
|
|
3
|
-
const notModuleRegistratorLogics = require(
|
|
4
|
-
|
|
5
|
-
module.exports = ({
|
|
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
|
-
|
|
1
|
+
const path = require("path");
|
|
2
|
+
|
|
3
|
+
const notModuleRegistratorLogics = require("../../src/manifest/registrator/logics");
|
|
4
|
+
|
|
5
|
+
module.exports = ({ expect }) => {
|
|
6
|
+
describe("notModuleRegistratorLogics", () => {
|
|
7
|
+
describe("getPath", () => {
|
|
8
|
+
it("module paths(logics)", function () {
|
|
9
|
+
const testPath = "path_to_logics";
|
|
10
|
+
const ctx = {
|
|
11
|
+
module: {
|
|
12
|
+
paths: {
|
|
13
|
+
logics: testPath,
|
|
14
|
+
},
|
|
15
|
+
},
|
|
16
|
+
};
|
|
17
|
+
const pathTo = notModuleRegistratorLogics.getPath(ctx);
|
|
18
|
+
expect(pathTo).to.be.equal(testPath);
|
|
19
|
+
});
|
|
20
|
+
});
|
|
21
|
+
|
|
22
|
+
describe("getName", () => {
|
|
23
|
+
it("get logics name, thisLogicName is set", function () {
|
|
24
|
+
const param = {
|
|
25
|
+
logic: {
|
|
26
|
+
thisLogicName: "thisLogicName",
|
|
27
|
+
},
|
|
28
|
+
file: "filename",
|
|
29
|
+
};
|
|
30
|
+
const name = notModuleRegistratorLogics.getName(param);
|
|
31
|
+
expect(name).to.be.equal("thisLogicName");
|
|
32
|
+
});
|
|
33
|
+
|
|
34
|
+
it("get logics name, thisLogicName is not set", function () {
|
|
35
|
+
const param = {
|
|
36
|
+
logic: {},
|
|
37
|
+
file: "filename",
|
|
38
|
+
};
|
|
39
|
+
const name = notModuleRegistratorLogics.getName(param);
|
|
40
|
+
expect(name).to.be.equal("filename");
|
|
41
|
+
});
|
|
42
|
+
});
|
|
43
|
+
|
|
44
|
+
describe("run", () => {
|
|
45
|
+
const logicsPath = path.join(__dirname, "../testies/module/logics");
|
|
46
|
+
it("path to logics is not defined", function () {
|
|
47
|
+
const ctx = {
|
|
48
|
+
findAll() {},
|
|
49
|
+
};
|
|
50
|
+
const param = {
|
|
51
|
+
nModule: {
|
|
52
|
+
module: { paths: {} },
|
|
53
|
+
},
|
|
54
|
+
};
|
|
55
|
+
const res = notModuleRegistratorLogics.run.call(ctx, param);
|
|
56
|
+
expect(res).to.be.false;
|
|
57
|
+
});
|
|
58
|
+
|
|
59
|
+
it("paths to logics is defined", function () {
|
|
60
|
+
const ctx = {
|
|
61
|
+
findAll() {},
|
|
62
|
+
};
|
|
63
|
+
const param = {
|
|
64
|
+
nModule: {
|
|
65
|
+
module: { paths: { logics: "path_to_logics" } },
|
|
66
|
+
},
|
|
67
|
+
};
|
|
68
|
+
const res = notModuleRegistratorLogics.run.call(ctx, param);
|
|
69
|
+
expect(res).to.be.true;
|
|
70
|
+
});
|
|
71
|
+
});
|
|
72
|
+
|
|
73
|
+
describe("extend", function () {
|
|
74
|
+
it("notApp exists", function () {
|
|
75
|
+
const logic = {
|
|
76
|
+
filename: "filename",
|
|
77
|
+
};
|
|
78
|
+
const ctx = {};
|
|
79
|
+
const param = {
|
|
80
|
+
logic,
|
|
81
|
+
logicName: "",
|
|
82
|
+
fromPath: "",
|
|
83
|
+
nModule: {
|
|
84
|
+
appIsSet() {
|
|
85
|
+
return true;
|
|
86
|
+
},
|
|
87
|
+
getApp() {
|
|
88
|
+
return {
|
|
89
|
+
getModel() {},
|
|
90
|
+
getModelFile() {},
|
|
91
|
+
getModelSchema() {},
|
|
92
|
+
getLogic() {},
|
|
93
|
+
getLogicFile() {},
|
|
94
|
+
getModule() {},
|
|
95
|
+
};
|
|
96
|
+
},
|
|
97
|
+
},
|
|
98
|
+
};
|
|
99
|
+
notModuleRegistratorLogics.extend.call(ctx, param);
|
|
100
|
+
|
|
101
|
+
expect(typeof logic.getModel).to.be.equal("function");
|
|
102
|
+
expect(typeof logic.getModelFile).to.be.equal("function");
|
|
103
|
+
expect(typeof logic.getModelSchema).to.be.equal("function");
|
|
104
|
+
expect(typeof logic.getLogic).to.be.equal("function");
|
|
105
|
+
expect(typeof logic.getLogicFile).to.be.equal("function");
|
|
106
|
+
expect(typeof logic.getModule).to.be.equal("function");
|
|
107
|
+
|
|
108
|
+
expect(typeof logic.log.log).to.be.equal("function");
|
|
109
|
+
expect(typeof logic.log.error).to.be.equal("function");
|
|
110
|
+
expect(typeof logic.log.debug).to.be.equal("function");
|
|
111
|
+
|
|
112
|
+
expect(logic).to.have.keys([
|
|
113
|
+
"getThisModule",
|
|
114
|
+
"filename",
|
|
115
|
+
"log",
|
|
116
|
+
"getModel",
|
|
117
|
+
"getModelFile",
|
|
118
|
+
"getModelSchema",
|
|
119
|
+
"getLogic",
|
|
120
|
+
"getLogicFile",
|
|
121
|
+
"getModule",
|
|
122
|
+
]);
|
|
123
|
+
expect(logic.getThisModule()).to.be.deep.equal(param.nModule);
|
|
124
|
+
});
|
|
125
|
+
|
|
126
|
+
it("notApp doesnt exists", function () {
|
|
127
|
+
const logic = {
|
|
128
|
+
filename: "filename",
|
|
129
|
+
};
|
|
130
|
+
const ctx = {};
|
|
131
|
+
const param = {
|
|
132
|
+
logic,
|
|
133
|
+
logicName: "",
|
|
134
|
+
fromPath: "",
|
|
135
|
+
nModule: {
|
|
136
|
+
appIsSet() {
|
|
137
|
+
return false;
|
|
138
|
+
},
|
|
139
|
+
getApp() {
|
|
140
|
+
return {
|
|
141
|
+
getModel() {},
|
|
142
|
+
getModelFile() {},
|
|
143
|
+
getModelSchema() {},
|
|
144
|
+
getModule() {},
|
|
145
|
+
};
|
|
146
|
+
},
|
|
147
|
+
},
|
|
148
|
+
};
|
|
149
|
+
notModuleRegistratorLogics.extend.call(ctx, param);
|
|
150
|
+
|
|
151
|
+
expect(typeof logic.log.log).to.be.equal("function");
|
|
152
|
+
expect(typeof logic.log.error).to.be.equal("function");
|
|
153
|
+
expect(typeof logic.log.debug).to.be.equal("function");
|
|
154
|
+
|
|
155
|
+
expect(logic).to.have.keys([
|
|
156
|
+
"getThisModule",
|
|
157
|
+
"filename",
|
|
158
|
+
"log",
|
|
159
|
+
]);
|
|
160
|
+
expect(logic.getThisModule()).to.be.deep.equal(param.nModule);
|
|
161
|
+
});
|
|
162
|
+
});
|
|
163
|
+
|
|
164
|
+
describe("register", () => {
|
|
165
|
+
const logicsPath = path.join(
|
|
166
|
+
__dirname,
|
|
167
|
+
"../testies/module/logics/one.js"
|
|
168
|
+
);
|
|
169
|
+
it("file exists", function (done) {
|
|
170
|
+
const ctx = {
|
|
171
|
+
extend() {},
|
|
172
|
+
};
|
|
173
|
+
const param = {
|
|
174
|
+
nModule: {
|
|
175
|
+
module: { paths: {} },
|
|
176
|
+
setLogic(logicName, logic) {
|
|
177
|
+
expect(logicName).to.be.equal("One");
|
|
178
|
+
done();
|
|
179
|
+
},
|
|
180
|
+
},
|
|
181
|
+
fromPath: logicsPath,
|
|
182
|
+
file: "one.js",
|
|
183
|
+
};
|
|
184
|
+
notModuleRegistratorLogics.register.call(ctx, param);
|
|
185
|
+
expect(res).to.be.false;
|
|
186
|
+
});
|
|
187
|
+
});
|
|
188
|
+
|
|
189
|
+
describe("findAll", () => {
|
|
190
|
+
const logicsPath = path.join(__dirname, "../testies/module/logics");
|
|
191
|
+
it("path exists", function () {
|
|
192
|
+
let result = [];
|
|
193
|
+
const ctx = {
|
|
194
|
+
register({ nModule, fromPath, file }) {
|
|
195
|
+
result.push(file);
|
|
196
|
+
},
|
|
197
|
+
};
|
|
198
|
+
const param = {
|
|
199
|
+
nModule: {
|
|
200
|
+
module: { paths: {} },
|
|
201
|
+
},
|
|
202
|
+
srcDir: logicsPath,
|
|
203
|
+
};
|
|
204
|
+
notModuleRegistratorLogics.findAll.call(ctx, param);
|
|
205
|
+
expect(result.sort()).to.be.deep.equal(
|
|
206
|
+
["one.js", "two.js", "three.js"].sort()
|
|
207
|
+
);
|
|
208
|
+
});
|
|
209
|
+
});
|
|
149
210
|
});
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
describe('register', () => {
|
|
153
|
-
const logicsPath = path.join(__dirname, '../testies/module/logics/one.js');
|
|
154
|
-
it('file exists', function(done) {
|
|
155
|
-
const ctx = {
|
|
156
|
-
extend(){}
|
|
157
|
-
};
|
|
158
|
-
const param = {
|
|
159
|
-
nModule:{
|
|
160
|
-
module:{ paths:{} },
|
|
161
|
-
setLogic(logicName, logic){
|
|
162
|
-
expect(logicName).to.be.equal('One');
|
|
163
|
-
done();
|
|
164
|
-
}
|
|
165
|
-
},
|
|
166
|
-
fromPath: logicsPath,
|
|
167
|
-
file: 'one.js'
|
|
168
|
-
};
|
|
169
|
-
notModuleRegistratorLogics.prototype.register.call(ctx, param);
|
|
170
|
-
expect(res).to.be.false;
|
|
171
|
-
});
|
|
172
|
-
});
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
describe('findAll', () => {
|
|
176
|
-
const logicsPath = path.join(__dirname, '../testies/module/logics');
|
|
177
|
-
it('path exists', function() {
|
|
178
|
-
let result = [];
|
|
179
|
-
const ctx = {
|
|
180
|
-
register({nModule, fromPath, file}){
|
|
181
|
-
result.push(file);
|
|
182
|
-
}
|
|
183
|
-
};
|
|
184
|
-
const param = {
|
|
185
|
-
nModule:{
|
|
186
|
-
module:{ paths:{} },
|
|
187
|
-
},
|
|
188
|
-
srcDir: logicsPath
|
|
189
|
-
};
|
|
190
|
-
notModuleRegistratorLogics.prototype.findAll.call(ctx, param);
|
|
191
|
-
expect(result.sort()).to.be.deep.equal(['one.js', 'two.js', 'three.js'].sort());
|
|
192
|
-
});
|
|
193
|
-
});
|
|
194
|
-
|
|
195
|
-
});
|
|
196
211
|
};
|