not-node 6.2.18 → 6.2.19
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/.husky/pre-commit +4 -0
- package/package.json +7 -4
- package/src/auth/roles.js +9 -1
- package/src/auth/rules.js +5 -5
- package/src/cli/actions/env.mjs +1 -1
- package/src/cli/actions/nginx.mjs +1 -1
- package/src/cli/actions/pm2.mjs +1 -1
- package/src/common.js +1 -1
- package/src/domain.js +36 -24
- package/src/identity/providers/session.js +3 -0
- package/src/manifest/batchRunner.js +5 -1
- package/src/manifest/registrator/fields.js +4 -4
- package/src/manifest/route.js +1 -0
- package/src/model/exceptions.js +3 -3
- package/src/model/versioning.js +2 -2
- package/test/auth/routes.js +34 -10
- package/test/fakes.js +52 -0
- package/test/identity/providers/session.js +14 -5
- package/test/identity/providers/token.js +1 -1
- package/test/init/additional.js +31 -33
- package/test/init/app.js +66 -10
- package/test/init/bodyparser.js +4 -1
- package/test/init/compression.js +4 -1
- package/test/init/cors.js +5 -1
- package/test/init/csp.js +2 -2
- package/test/init/db.js +5 -1
- package/test/init/env.js +12 -2
- package/test/init/express.js +4 -1
- package/test/init/fileupload.js +4 -1
- package/test/init/http.js +21 -4
- package/test/init/middleware.js +13 -1
- package/test/init/routes.js +1 -0
- package/test/init/sessions/mongoose.js +5 -1
- package/test/init/sessions/redis.js +5 -1
- package/test/init/sessions.js +21 -15
- package/test/init/static.js +4 -1
- package/test/init/template.js +5 -1
- package/test/model/versioning.js +3 -3
- package/test/module/fields.js +45 -20
- package/test/module/index.js +26 -15
- package/test/notApp.js +221 -187
- package/test/notDomain.js +799 -707
- package/test/notManifestFilter.js +385 -322
- package/test/notModule.js +689 -644
- package/test/notRoute.js +112 -99
- package/test/testies/module/fields/collection.js +16 -14
- package/test/testies/module/fields/single.js +11 -11
|
@@ -1,337 +1,400 @@
|
|
|
1
|
-
const expect = require(
|
|
2
|
-
|
|
3
|
-
|
|
1
|
+
const expect = require("chai").expect,
|
|
2
|
+
notManifestFilter = require("../src/manifest/manifest.filter");
|
|
4
3
|
|
|
5
4
|
const rawRoutesManifest = {
|
|
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
|
-
|
|
5
|
+
admin: {
|
|
6
|
+
model: "admin",
|
|
7
|
+
url: "/api/:modelName",
|
|
8
|
+
actions: {
|
|
9
|
+
reboot: {
|
|
10
|
+
method: "post",
|
|
11
|
+
rules: [
|
|
12
|
+
{
|
|
13
|
+
root: true,
|
|
14
|
+
},
|
|
15
|
+
],
|
|
16
|
+
},
|
|
17
|
+
},
|
|
18
|
+
},
|
|
19
|
+
post: {
|
|
20
|
+
model: "post",
|
|
21
|
+
url: "/api/:modelName",
|
|
22
|
+
actions: {
|
|
23
|
+
list: {
|
|
24
|
+
method: "get",
|
|
25
|
+
rules: [
|
|
26
|
+
{
|
|
27
|
+
auth: false,
|
|
28
|
+
},
|
|
29
|
+
{
|
|
30
|
+
auth: true,
|
|
31
|
+
actionPrefix: "user",
|
|
32
|
+
},
|
|
33
|
+
{
|
|
34
|
+
root: true,
|
|
35
|
+
actionName: "listForAdmin",
|
|
36
|
+
},
|
|
37
|
+
],
|
|
38
|
+
},
|
|
39
|
+
listAll: {
|
|
40
|
+
method: "get",
|
|
41
|
+
rules: [
|
|
42
|
+
{
|
|
43
|
+
auth: true,
|
|
44
|
+
role: ["manager"],
|
|
45
|
+
actionName: "managerListAll",
|
|
46
|
+
},
|
|
47
|
+
{
|
|
48
|
+
root: true,
|
|
49
|
+
actionPrefix: "__",
|
|
50
|
+
actionName: "listForAdmin",
|
|
51
|
+
},
|
|
52
|
+
],
|
|
53
|
+
},
|
|
54
|
+
},
|
|
55
|
+
},
|
|
56
|
+
user: {
|
|
57
|
+
model: "user",
|
|
58
|
+
url: "/api/:modelName",
|
|
59
|
+
actions: {
|
|
60
|
+
list: {
|
|
61
|
+
method: "get",
|
|
62
|
+
rules: [
|
|
63
|
+
{
|
|
64
|
+
root: true,
|
|
65
|
+
},
|
|
66
|
+
],
|
|
67
|
+
},
|
|
68
|
+
profile: {
|
|
69
|
+
method: "get",
|
|
70
|
+
rules: [
|
|
71
|
+
{
|
|
72
|
+
auth: true,
|
|
73
|
+
},
|
|
74
|
+
{
|
|
75
|
+
root: true,
|
|
76
|
+
},
|
|
77
|
+
],
|
|
78
|
+
},
|
|
79
|
+
activate: {
|
|
80
|
+
method: "get",
|
|
81
|
+
auth: false,
|
|
82
|
+
role: "notActivated",
|
|
83
|
+
},
|
|
84
|
+
},
|
|
85
|
+
},
|
|
86
|
+
journal: {},
|
|
87
|
+
files: { actions: { empty: undefined } },
|
|
75
88
|
};
|
|
76
89
|
|
|
77
|
-
describe(
|
|
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
|
-
modelName: 'jelly',
|
|
103
|
-
auth: true,
|
|
104
|
-
role: ['root'],
|
|
105
|
-
root: true
|
|
106
|
-
};
|
|
107
|
-
const result = notManifestFilter.clearActionFromRules(input);
|
|
108
|
-
expect(result).to.deep.equal({
|
|
109
|
-
modelName: 'jelly'
|
|
110
|
-
});
|
|
111
|
-
});
|
|
112
|
-
});
|
|
113
|
-
|
|
114
|
-
describe('filterRoute', function () {
|
|
115
|
-
const route = {
|
|
116
|
-
actions: {
|
|
117
|
-
list: {
|
|
118
|
-
postFix: ':actionName',
|
|
119
|
-
rules: [{
|
|
120
|
-
root: true
|
|
121
|
-
}, {
|
|
122
|
-
auth: true
|
|
123
|
-
}, {
|
|
124
|
-
auth: false
|
|
125
|
-
}]
|
|
126
|
-
},
|
|
127
|
-
get: {
|
|
128
|
-
formData: true,
|
|
129
|
-
rules: [{
|
|
130
|
-
root: true
|
|
131
|
-
}]
|
|
132
|
-
},
|
|
133
|
-
update: {
|
|
134
|
-
formData: false,
|
|
135
|
-
auth: true,
|
|
136
|
-
role: ['manager']
|
|
137
|
-
}
|
|
138
|
-
}
|
|
139
|
-
};
|
|
140
|
-
it('route [{admin},{auth},{!auth}], !auth, \'user\', !admin', function () {
|
|
141
|
-
const result = notManifestFilter.filterRoute(route, false, 'user', false);
|
|
142
|
-
expect(result).to.deep.equal({
|
|
143
|
-
actions: {
|
|
144
|
-
list: {
|
|
145
|
-
postFix: ':actionName'
|
|
146
|
-
}
|
|
147
|
-
}
|
|
148
|
-
});
|
|
149
|
-
});
|
|
150
|
-
|
|
151
|
-
it('route [{admin},{auth},{!auth}], !auth, \'user\', admin', function () {
|
|
152
|
-
const result = notManifestFilter.filterRoute(route, false, 'user', true);
|
|
153
|
-
expect(result).to.deep.equal({
|
|
154
|
-
actions: {
|
|
155
|
-
list: {
|
|
156
|
-
postFix: ':actionName'
|
|
157
|
-
},
|
|
158
|
-
get: {
|
|
159
|
-
formData: true
|
|
160
|
-
}
|
|
161
|
-
}
|
|
162
|
-
});
|
|
163
|
-
});
|
|
164
|
-
|
|
165
|
-
it('route [{admin},{auth},{!auth}], auth, \'user\', !admin', function () {
|
|
166
|
-
const result = notManifestFilter.filterRoute(route, true, 'user', false);
|
|
167
|
-
expect(result).to.deep.equal({
|
|
168
|
-
actions: {
|
|
169
|
-
list: {
|
|
170
|
-
postFix: ':actionName'
|
|
171
|
-
}
|
|
172
|
-
}
|
|
173
|
-
});
|
|
174
|
-
});
|
|
90
|
+
describe("notManifestFilter", function () {
|
|
91
|
+
describe("clearActionFromRules", function () {
|
|
92
|
+
it("with rules", function () {
|
|
93
|
+
const input = {
|
|
94
|
+
modelName: "jelly",
|
|
95
|
+
rules: [
|
|
96
|
+
{
|
|
97
|
+
auth: true,
|
|
98
|
+
fields: ["name"],
|
|
99
|
+
},
|
|
100
|
+
{
|
|
101
|
+
root: true,
|
|
102
|
+
fields: ["name", "email"],
|
|
103
|
+
},
|
|
104
|
+
],
|
|
105
|
+
};
|
|
106
|
+
const result = notManifestFilter.clearActionFromRules(input, {
|
|
107
|
+
root: true,
|
|
108
|
+
fields: ["name", "email"],
|
|
109
|
+
});
|
|
110
|
+
expect(result).to.deep.equal({
|
|
111
|
+
modelName: "jelly",
|
|
112
|
+
fields: ["name", "email"],
|
|
113
|
+
});
|
|
114
|
+
});
|
|
175
115
|
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
116
|
+
it("without rules", function () {
|
|
117
|
+
const input = {
|
|
118
|
+
modelName: "jelly",
|
|
119
|
+
auth: true,
|
|
120
|
+
role: ["root"],
|
|
121
|
+
root: true,
|
|
122
|
+
};
|
|
123
|
+
const result = notManifestFilter.clearActionFromRules(input);
|
|
124
|
+
expect(result).to.deep.equal({
|
|
125
|
+
modelName: "jelly",
|
|
126
|
+
});
|
|
127
|
+
});
|
|
128
|
+
});
|
|
189
129
|
|
|
190
|
-
|
|
130
|
+
describe("filterRoute", function () {
|
|
131
|
+
const route = {
|
|
132
|
+
actions: {
|
|
133
|
+
list: {
|
|
134
|
+
postFix: ":actionName",
|
|
135
|
+
rules: [
|
|
136
|
+
{
|
|
137
|
+
root: true,
|
|
138
|
+
},
|
|
139
|
+
{
|
|
140
|
+
auth: true,
|
|
141
|
+
},
|
|
142
|
+
{
|
|
143
|
+
auth: false,
|
|
144
|
+
},
|
|
145
|
+
],
|
|
146
|
+
},
|
|
147
|
+
get: {
|
|
148
|
+
formData: true,
|
|
149
|
+
rules: [
|
|
150
|
+
{
|
|
151
|
+
root: true,
|
|
152
|
+
},
|
|
153
|
+
],
|
|
154
|
+
},
|
|
155
|
+
update: {
|
|
156
|
+
formData: false,
|
|
157
|
+
auth: true,
|
|
158
|
+
role: ["manager"],
|
|
159
|
+
},
|
|
160
|
+
},
|
|
161
|
+
};
|
|
162
|
+
it("route [{admin},{auth},{!auth}], !auth, 'user', !admin", function () {
|
|
163
|
+
const result = notManifestFilter.filterRoute(
|
|
164
|
+
route,
|
|
165
|
+
false,
|
|
166
|
+
"user",
|
|
167
|
+
false
|
|
168
|
+
);
|
|
169
|
+
expect(result).to.deep.equal({
|
|
170
|
+
actions: {
|
|
171
|
+
list: {
|
|
172
|
+
postFix: ":actionName",
|
|
173
|
+
},
|
|
174
|
+
},
|
|
175
|
+
});
|
|
176
|
+
});
|
|
191
177
|
|
|
178
|
+
it("route [{admin},{auth},{!auth}], !auth, 'user', admin", function () {
|
|
179
|
+
const result = notManifestFilter.filterRoute(
|
|
180
|
+
route,
|
|
181
|
+
false,
|
|
182
|
+
"user",
|
|
183
|
+
true
|
|
184
|
+
);
|
|
185
|
+
expect(result).to.deep.equal({
|
|
186
|
+
actions: {
|
|
187
|
+
list: {
|
|
188
|
+
postFix: ":actionName",
|
|
189
|
+
},
|
|
190
|
+
get: {
|
|
191
|
+
formData: true,
|
|
192
|
+
},
|
|
193
|
+
},
|
|
194
|
+
});
|
|
195
|
+
});
|
|
192
196
|
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
post: {
|
|
209
|
-
model: 'post',
|
|
210
|
-
url: '/api/:modelName',
|
|
211
|
-
actions: {
|
|
212
|
-
list: {
|
|
213
|
-
method: 'get'
|
|
214
|
-
},
|
|
215
|
-
listAll: {
|
|
216
|
-
method: 'get'
|
|
217
|
-
}
|
|
218
|
-
}
|
|
219
|
-
},
|
|
220
|
-
admin: {
|
|
221
|
-
model: 'admin',
|
|
222
|
-
url: '/api/:modelName',
|
|
223
|
-
actions: {
|
|
224
|
-
reboot: {
|
|
225
|
-
method: 'post'
|
|
226
|
-
}
|
|
227
|
-
}
|
|
228
|
-
}
|
|
229
|
-
},
|
|
230
|
-
user: {
|
|
231
|
-
user: {
|
|
232
|
-
model: 'user',
|
|
233
|
-
url: '/api/:modelName',
|
|
234
|
-
actions: {
|
|
235
|
-
profile: {
|
|
236
|
-
method: 'get'
|
|
237
|
-
}
|
|
238
|
-
}
|
|
239
|
-
},
|
|
240
|
-
post: {
|
|
241
|
-
model: 'post',
|
|
242
|
-
url: '/api/:modelName',
|
|
243
|
-
actions: {
|
|
244
|
-
list: {
|
|
245
|
-
method: 'get'
|
|
246
|
-
}
|
|
247
|
-
}
|
|
248
|
-
}
|
|
249
|
-
},
|
|
250
|
-
guest: {
|
|
251
|
-
post: {
|
|
252
|
-
model: 'post',
|
|
253
|
-
url: '/api/:modelName',
|
|
254
|
-
actions: {
|
|
255
|
-
list: {
|
|
256
|
-
method: 'get'
|
|
257
|
-
}
|
|
258
|
-
}
|
|
259
|
-
}
|
|
260
|
-
},
|
|
261
|
-
notActivated: {
|
|
262
|
-
user: {
|
|
263
|
-
model: 'user',
|
|
264
|
-
url: '/api/:modelName',
|
|
265
|
-
actions: {
|
|
266
|
-
activate: {
|
|
267
|
-
method: 'get'
|
|
268
|
-
}
|
|
269
|
-
}
|
|
270
|
-
},
|
|
271
|
-
post: {
|
|
272
|
-
model: 'post',
|
|
273
|
-
url: '/api/:modelName',
|
|
274
|
-
actions: {
|
|
275
|
-
list: {
|
|
276
|
-
method: 'get'
|
|
277
|
-
}
|
|
278
|
-
}
|
|
279
|
-
}
|
|
280
|
-
},
|
|
281
|
-
manager: {
|
|
282
|
-
user: {
|
|
283
|
-
model: 'user',
|
|
284
|
-
url: '/api/:modelName',
|
|
285
|
-
actions: {
|
|
286
|
-
profile: {
|
|
287
|
-
method: 'get'
|
|
288
|
-
}
|
|
289
|
-
}
|
|
290
|
-
},
|
|
291
|
-
post: {
|
|
292
|
-
model: 'post',
|
|
293
|
-
url: '/api/:modelName',
|
|
294
|
-
actions: {
|
|
295
|
-
list: {
|
|
296
|
-
method: 'get'
|
|
297
|
-
},
|
|
298
|
-
listAll: {
|
|
299
|
-
method: 'get'
|
|
300
|
-
}
|
|
301
|
-
}
|
|
302
|
-
}
|
|
303
|
-
}
|
|
304
|
-
};
|
|
305
|
-
it('Guest manifest', function () {
|
|
306
|
-
let man = rawRoutesManifest,
|
|
307
|
-
manAfterFilter = notManifestFilter.filter(man, false, false, false);
|
|
308
|
-
expect(manAfterFilter).to.deep.equal(filtered.guest);
|
|
309
|
-
});
|
|
197
|
+
it("route [{admin},{auth},{!auth}], auth, 'user', !admin", function () {
|
|
198
|
+
const result = notManifestFilter.filterRoute(
|
|
199
|
+
route,
|
|
200
|
+
true,
|
|
201
|
+
"user",
|
|
202
|
+
false
|
|
203
|
+
);
|
|
204
|
+
expect(result).to.deep.equal({
|
|
205
|
+
actions: {
|
|
206
|
+
list: {
|
|
207
|
+
postFix: ":actionName",
|
|
208
|
+
},
|
|
209
|
+
},
|
|
210
|
+
});
|
|
211
|
+
});
|
|
310
212
|
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
213
|
+
it("route [{admin},{auth},{!auth}], auth, 'manager', !admin", function () {
|
|
214
|
+
const result = notManifestFilter.filterRoute(
|
|
215
|
+
route,
|
|
216
|
+
true,
|
|
217
|
+
"manager",
|
|
218
|
+
false
|
|
219
|
+
);
|
|
220
|
+
expect(result).to.deep.equal({
|
|
221
|
+
actions: {
|
|
222
|
+
list: {
|
|
223
|
+
postFix: ":actionName",
|
|
224
|
+
},
|
|
225
|
+
update: {
|
|
226
|
+
formData: false,
|
|
227
|
+
},
|
|
228
|
+
},
|
|
229
|
+
});
|
|
230
|
+
});
|
|
231
|
+
});
|
|
316
232
|
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
233
|
+
describe("filter", function () {
|
|
234
|
+
let filtered = {
|
|
235
|
+
admin: {
|
|
236
|
+
user: {
|
|
237
|
+
model: "user",
|
|
238
|
+
url: "/api/:modelName",
|
|
239
|
+
actions: {
|
|
240
|
+
list: {
|
|
241
|
+
method: "get",
|
|
242
|
+
},
|
|
243
|
+
profile: {
|
|
244
|
+
method: "get",
|
|
245
|
+
},
|
|
246
|
+
},
|
|
247
|
+
},
|
|
248
|
+
post: {
|
|
249
|
+
model: "post",
|
|
250
|
+
url: "/api/:modelName",
|
|
251
|
+
actions: {
|
|
252
|
+
list: {
|
|
253
|
+
method: "get",
|
|
254
|
+
},
|
|
255
|
+
listAll: {
|
|
256
|
+
method: "get",
|
|
257
|
+
},
|
|
258
|
+
},
|
|
259
|
+
},
|
|
260
|
+
admin: {
|
|
261
|
+
model: "admin",
|
|
262
|
+
url: "/api/:modelName",
|
|
263
|
+
actions: {
|
|
264
|
+
reboot: {
|
|
265
|
+
method: "post",
|
|
266
|
+
},
|
|
267
|
+
},
|
|
268
|
+
},
|
|
269
|
+
},
|
|
270
|
+
user: {
|
|
271
|
+
user: {
|
|
272
|
+
model: "user",
|
|
273
|
+
url: "/api/:modelName",
|
|
274
|
+
actions: {
|
|
275
|
+
profile: {
|
|
276
|
+
method: "get",
|
|
277
|
+
},
|
|
278
|
+
},
|
|
279
|
+
},
|
|
280
|
+
post: {
|
|
281
|
+
model: "post",
|
|
282
|
+
url: "/api/:modelName",
|
|
283
|
+
actions: {
|
|
284
|
+
list: {
|
|
285
|
+
method: "get",
|
|
286
|
+
},
|
|
287
|
+
},
|
|
288
|
+
},
|
|
289
|
+
},
|
|
290
|
+
guest: {
|
|
291
|
+
post: {
|
|
292
|
+
model: "post",
|
|
293
|
+
url: "/api/:modelName",
|
|
294
|
+
actions: {
|
|
295
|
+
list: {
|
|
296
|
+
method: "get",
|
|
297
|
+
},
|
|
298
|
+
},
|
|
299
|
+
},
|
|
300
|
+
},
|
|
301
|
+
notActivated: {
|
|
302
|
+
user: {
|
|
303
|
+
model: "user",
|
|
304
|
+
url: "/api/:modelName",
|
|
305
|
+
actions: {
|
|
306
|
+
activate: {
|
|
307
|
+
method: "get",
|
|
308
|
+
},
|
|
309
|
+
},
|
|
310
|
+
},
|
|
311
|
+
post: {
|
|
312
|
+
model: "post",
|
|
313
|
+
url: "/api/:modelName",
|
|
314
|
+
actions: {
|
|
315
|
+
list: {
|
|
316
|
+
method: "get",
|
|
317
|
+
},
|
|
318
|
+
},
|
|
319
|
+
},
|
|
320
|
+
},
|
|
321
|
+
manager: {
|
|
322
|
+
user: {
|
|
323
|
+
model: "user",
|
|
324
|
+
url: "/api/:modelName",
|
|
325
|
+
actions: {
|
|
326
|
+
profile: {
|
|
327
|
+
method: "get",
|
|
328
|
+
},
|
|
329
|
+
},
|
|
330
|
+
},
|
|
331
|
+
post: {
|
|
332
|
+
model: "post",
|
|
333
|
+
url: "/api/:modelName",
|
|
334
|
+
actions: {
|
|
335
|
+
list: {
|
|
336
|
+
method: "get",
|
|
337
|
+
},
|
|
338
|
+
listAll: {
|
|
339
|
+
method: "get",
|
|
340
|
+
},
|
|
341
|
+
},
|
|
342
|
+
},
|
|
343
|
+
},
|
|
344
|
+
};
|
|
345
|
+
it("Guest manifest", function () {
|
|
346
|
+
let man = rawRoutesManifest,
|
|
347
|
+
manAfterFilter = notManifestFilter.filter(
|
|
348
|
+
man,
|
|
349
|
+
false,
|
|
350
|
+
false,
|
|
351
|
+
false
|
|
352
|
+
);
|
|
353
|
+
expect(manAfterFilter).to.deep.equal(filtered.guest);
|
|
354
|
+
});
|
|
322
355
|
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
356
|
+
it("Auth manifest", function () {
|
|
357
|
+
let man = rawRoutesManifest,
|
|
358
|
+
manAfterFilter = notManifestFilter.filter(
|
|
359
|
+
man,
|
|
360
|
+
true,
|
|
361
|
+
false,
|
|
362
|
+
false
|
|
363
|
+
);
|
|
364
|
+
expect(manAfterFilter).to.deep.equal(filtered.user);
|
|
365
|
+
});
|
|
328
366
|
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
367
|
+
it("Auth with manager role manifest", function () {
|
|
368
|
+
let man = rawRoutesManifest,
|
|
369
|
+
manAfterFilter = notManifestFilter.filter(
|
|
370
|
+
man,
|
|
371
|
+
true,
|
|
372
|
+
"manager",
|
|
373
|
+
false
|
|
374
|
+
);
|
|
375
|
+
expect(manAfterFilter).to.deep.equal(filtered.manager);
|
|
376
|
+
});
|
|
335
377
|
|
|
378
|
+
it("Guest with notActivated role manifest", function () {
|
|
379
|
+
let man = rawRoutesManifest,
|
|
380
|
+
manAfterFilter = notManifestFilter.filter(
|
|
381
|
+
man,
|
|
382
|
+
false,
|
|
383
|
+
"notActivated",
|
|
384
|
+
false
|
|
385
|
+
);
|
|
386
|
+
expect(manAfterFilter).to.deep.equal(filtered.notActivated);
|
|
387
|
+
});
|
|
336
388
|
|
|
389
|
+
it("Admin manifest", function () {
|
|
390
|
+
let man = rawRoutesManifest,
|
|
391
|
+
manAfterFilter = notManifestFilter.filter(
|
|
392
|
+
man,
|
|
393
|
+
false,
|
|
394
|
+
false,
|
|
395
|
+
true
|
|
396
|
+
);
|
|
397
|
+
expect(manAfterFilter).to.deep.equal(filtered.admin);
|
|
398
|
+
});
|
|
399
|
+
});
|
|
337
400
|
});
|