not-node 5.1.44 → 5.1.45

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/test/auth.js CHANGED
@@ -1,230 +1,443 @@
1
- require('not-log')(false);
2
-
3
- const expect = require('chai').expect,
4
- auth = require('../src/auth'),
5
- HttpError = require('../src/error').Http;
6
-
7
- describe('Auth', function() {
8
-
9
- describe('intersect_safe', function() {
10
- it('a - array, b - array', function() {
11
- var res = auth.intersect_safe(['safe1', 'safe', 'unsafebutpresented'], ['unsafe','safe', 'safeguard']);
12
- expect(res).to.deep.equal(['safe']);
13
- });
14
-
15
- it('a - array, b - array with more length', function() {
16
- var res = auth.intersect_safe(['safe1', 'safe', 'unsafebutpresented'], ['unsafe','safeasdfjsdjkf','safe', 'safeguard']);
17
- expect(res).to.deep.equal(['safe']);
18
- });
19
-
20
- it('a - null, b - null', function() {
21
- var res = auth.intersect_safe(null, null);
22
- expect(res).to.deep.equal([]);
23
- });
24
-
25
- it('intersection of a and b equals empty', function() {
26
- var res = auth.intersect_safe(['safe1'], ['safe2']);
27
- expect(res).to.deep.equal([]);
28
- });
29
-
30
- it('intersection of a = b', function() {
31
- var res = auth.intersect_safe(['safe'], ['safe']);
32
- expect(res).to.deep.equal(['safe']);
33
- });
34
- });
35
-
36
-
37
- describe('compareRoles', function() {
38
- it('user - guest, action - root', function() {
39
- var res = auth.compareRoles('guest', 'root');
40
- expect(res).to.deep.equal(false);
41
- });
42
-
43
- it('user - guest, action - guest', function() {
44
- var res = auth.compareRoles('guest', 'guest');
45
- expect(res).to.deep.equal(true);
46
- });
47
-
48
- it('user - guest, action - [root, admin]', function() {
49
- var res = auth.compareRoles('guest', ['root', 'admin']);
50
- expect(res).to.deep.equal(false);
51
- });
52
-
53
- it('user - guest, action - [root, admin, guest], strict - false', function() {
54
- var res = auth.compareRoles('guest', ['root', 'admin', 'guest'], false);
55
- expect(res).to.deep.equal(true);
56
- });
57
-
58
- it('user - guest, action - [root, admin, guest], strict - true', function() {
59
- var res = auth.compareRoles('guest', ['root', 'admin', 'guest']);
60
- expect(res).to.deep.equal(false);
61
- });
62
-
63
- it('user - [user, notActivated], action - notActivated', function() {
64
- var res = auth.compareRoles(['user', 'notActivated'], 'notActivated');
65
- expect(res).to.deep.equal(true);
66
- });
67
-
68
- it('user - [user, notActivated, jailed], action - [root, manager]', function() {
69
- var res = auth.compareRoles(['user', 'notActivated', 'jailed'], ['root', 'manager']);
70
- expect(res).to.deep.equal(false);
71
- });
72
-
73
- });
74
-
75
-
76
- describe('checkCredentials', function() {
77
- const rule = {
78
- admin: true,
79
- role: 'root',
80
- auth: true
81
- };
82
- it('rule (admin, root, authentificated), auth - true, role - root, admin - true ', function() {
83
- const res = auth.checkCredentials(rule, true, 'root', true);
84
- expect(res).to.deep.equal(true);
85
- });
86
-
87
- it('rule (admin, root, authentificated), auth - true, role - root, admin - false ', function() {
88
- const res = auth.checkCredentials(rule, true, 'root', false);
89
- expect(res).to.deep.equal(false);
90
- });
91
-
92
- it('rule - empty, auth - true, role - root, admin - false ', function() {
93
- const res = auth.checkCredentials({}, true, 'root', false);
94
- expect(res).to.deep.equal(true);
95
- });
96
-
97
- it('rule - null, auth - true, role - root, admin - false ', function() {
98
- const res = auth.checkCredentials(null, true, 'root', false);
99
- expect(res).to.deep.equal(false);
100
- });
101
-
102
-
103
- it('rule - (auth), auth - true, role - root, admin - false ', function() {
104
- const res = auth.checkCredentials({auth: true}, true, 'root', false);
105
- expect(res).to.deep.equal(true);
106
- });
107
-
108
- it('rule - (role: \'notActivated\'), auth - true, role - root, admin - false ', function() {
109
- const res = auth.checkCredentials({role: 'notActivated'}, true, 'root', false);
110
- expect(res).to.deep.equal(false);
111
- });
112
-
113
- it('rule - (role: \'user\', auth), auth - true, role - user, admin - false ', function() {
114
- const res = auth.checkCredentials({role: 'user', auth: true}, true, 'user', false);
115
- expect(res).to.deep.equal(true);
116
- });
117
-
118
- it('rule - (role: \'user\', !auth), auth - false, role - user, admin - false ', function() {
119
- const res = auth.checkCredentials({role: 'user', auth: false}, false, 'user', false);
120
- expect(res).to.deep.equal(true);
121
- });
122
-
123
- it('rule - (role: \'user\'), auth - false, role - user, admin - false ', function() {
124
- const res = auth.checkCredentials({role: 'user'}, false, 'user', false);
125
- expect(res).to.deep.equal(true);
126
- });
127
-
128
- it('rule - (auth), auth - true, role - user, admin - false ', function() {
129
- const res = auth.checkCredentials({auth: true}, true, 'user', false);
130
- expect(res).to.deep.equal(true);
131
- });
132
-
133
- it('rule - (!auth), auth - false, role - user, admin - false ', function() {
134
- const res = auth.checkCredentials({auth: false}, false, 'user', false);
135
- expect(res).to.deep.equal(true);
136
- });
137
-
138
- it('rule - (auth), auth - false, role - user, admin - false ', function() {
139
- const res = auth.checkCredentials({auth: true}, false, 'user', false);
140
- expect(res).to.deep.equal(false);
141
- });
142
-
143
- it('rule - (!auth), auth - false, role - user, admin - true ', function() {
144
- const res = auth.checkCredentials({auth: false}, false, 'user', true);
145
- expect(res).to.deep.equal(true);
146
- });
147
-
148
- it('rule - (admin), auth - false, role - user, admin - true ', function() {
149
- const res = auth.checkCredentials({admin: true}, false, 'user', true);
150
- expect(res).to.deep.equal(true);
151
- });
152
-
153
- it('rule - (!auth, \'notActivated\', false), auth - false, role - notActivated, admin - false ', function() {
154
- const res = auth.checkCredentials({auth: false, role: 'notActivated'}, false, 'notActivated', false);
155
- expect(res).to.deep.equal(true);
156
- });
157
-
158
- it('rule - (!auth, \'notActivated\', undefined), auth - false, role - false, admin - false ', function() {
159
- const res = auth.checkCredentials({auth: false, role: 'notActivated'}, false, false, false);
160
- expect(res).to.deep.equal(false);
161
- });
162
-
163
- it('rule - (admin), auth - false, role - false, admin - true ', function() {
164
- const res = auth.checkCredentials({admin: true}, false, false, true);
165
- expect(res).to.deep.equal(true);
166
- });
167
- });
168
-
169
- describe('checkSupremacy', function() {
170
-
171
- it('Both undefined, order undefined', function() {
172
- let resultFunction = ()=>{ auth.checkSupremacy(undefined, 'undefined', undefined);}
173
- expect(resultFunction).to.throw();
174
- resultFunction = ()=>{ auth.checkSupremacy('undefined', undefined, undefined);}
175
- expect(resultFunction).to.throw();
176
- resultFunction = ()=>{ auth.checkSupremacy('undefined', 'undefined', undefined);}
177
- expect(resultFunction).to.throw();
178
- });
179
-
180
- it('Both undefined, order defined but not Array', function() {
181
- let resultFunction = ()=>{ auth.checkSupremacy('undefined', 'undefined', 12);}
182
- expect(resultFunction).to.throw();
183
- });
184
-
185
- it('Both undefined, order defined Array with wrong types of element', function() {
186
- let resultFunction = ()=>{ auth.checkSupremacy('undefined', 'undefined', [12]);}
187
- expect(resultFunction).to.throw();
188
- });
189
-
190
- it('Both undefined, order defined Array with wrong types of element', function() {
191
- let resultFunction = ()=>{ auth.checkSupremacy('undefined', 'undefined', [null]);}
192
- expect(resultFunction).to.throw();
193
- });
194
-
195
- it('Both undefined, order defined Array with wrong types of element', function() {
196
- let resultFunction = ()=>{ auth.checkSupremacy('undefined', 'undefined', [null]);}
197
- expect(resultFunction).to.throw();
198
- });
199
-
200
- it('Both defined, order list dont contains roles of sets', function() {
201
- expect(auth.checkSupremacy('undefined', 'undefined', ['root'])).to.be.equal(false);
202
- });
203
-
204
- it('Various situations with valid input', function() {
205
- expect(auth.checkSupremacy('undefined', 'undefined', ['root', 'admin', 'client', 'user', 'guest'])).to.be.equal(false);
206
- expect(auth.checkSupremacy('root', ['root'], ['root', 'admin', 'client', 'user', 'guest'])).to.be.equal(false);
207
- expect(auth.checkSupremacy('undefined', 'root', ['root', 'admin', 'client', 'user', 'guest'])).to.be.equal(false);
208
- expect(auth.checkSupremacy('undefined', 'guest', ['root', 'admin', 'client', 'user', 'guest'])).to.be.equal(false);
209
- expect(auth.checkSupremacy('root', ['undefined', 'manager'], ['root', 'admin', 'client', 'user', 'guest'])).to.be.equal(true);
210
- expect(auth.checkSupremacy('client', 'root', ['root', 'admin', 'client', 'user', 'guest'])).to.be.equal(false);
211
- expect(auth.checkSupremacy('client', 'client', ['root', 'admin', 'client', 'user', 'guest'])).to.be.equal(false);
212
- expect(auth.checkSupremacy('guest', 'guest', ['root', 'admin', 'client', 'user', 'guest'])).to.be.equal(false);
213
- expect(auth.checkSupremacy('guest', 'root', ['root', 'admin', 'client', 'user', 'guest'])).to.be.equal(false);
214
- expect(auth.checkSupremacy('client', ['root', 'guest'], ['root', 'admin', 'client', 'user', 'guest'])).to.be.equal(false);
215
- expect(auth.checkSupremacy('client', 'guest', ['root', 'admin', 'client', 'user', 'guest'])).to.be.equal(true);
216
- expect(auth.checkSupremacy(['admin', 'manager'], 'guest', ['root', 'admin', 'client', 'user', 'guest'])).to.be.equal(true);
217
- expect(auth.checkSupremacy(['client', 'manager'], 'client', ['root', 'admin', 'client', 'user', 'guest'])).to.be.equal(false);
218
- expect(auth.checkSupremacy(['admin'], 'root', ['root', 'admin', 'client', 'user', 'guest'])).to.be.equal(false);
219
- expect(auth.checkSupremacy('manager', 'client', ['root', 'admin', 'client', 'user', 'guest'])).to.be.equal(false);
220
- expect(auth.checkSupremacy('admin', 'client', ['root', 'admin', 'client', 'user', 'guest'])).to.be.equal(true);
221
- });
222
- });
223
-
224
- require('./auth/routes.js')({Auth: auth, HttpError, expect});
225
- require('./auth/roles.js')({Auth: auth, HttpError, expect});
226
- require('./auth/rules.js')({Auth: auth, HttpError, expect});
227
- require('./auth/session.js')({Auth: auth, HttpError, expect});
228
- require('./auth/obsolete.js')({Auth: auth, HttpError, expect});
229
- require('./auth/fields.js')({Auth: auth, HttpError, expect});
1
+ require("not-log")(false);
2
+
3
+ const expect = require("chai").expect,
4
+ auth = require("../src/auth"),
5
+ HttpError = require("../src/error").Http;
6
+
7
+ describe("Auth", function () {
8
+ describe("intersect_safe", function () {
9
+ it("a - array, b - array", function () {
10
+ var res = auth.intersect_safe(
11
+ ["safe1", "safe", "unsafebutpresented"],
12
+ ["unsafe", "safe", "safeguard"]
13
+ );
14
+ expect(res).to.deep.equal(["safe"]);
15
+ });
16
+
17
+ it("a - array, b - array with more length", function () {
18
+ var res = auth.intersect_safe(
19
+ ["safe1", "safe", "unsafebutpresented"],
20
+ ["unsafe", "safeasdfjsdjkf", "safe", "safeguard"]
21
+ );
22
+ expect(res).to.deep.equal(["safe"]);
23
+ });
24
+
25
+ it("a - null, b - null", function () {
26
+ var res = auth.intersect_safe(null, null);
27
+ expect(res).to.deep.equal([]);
28
+ });
29
+
30
+ it("intersection of a and b equals empty", function () {
31
+ var res = auth.intersect_safe(["safe1"], ["safe2"]);
32
+ expect(res).to.deep.equal([]);
33
+ });
34
+
35
+ it("intersection of a = b", function () {
36
+ var res = auth.intersect_safe(["safe"], ["safe"]);
37
+ expect(res).to.deep.equal(["safe"]);
38
+ });
39
+ });
40
+
41
+ describe("compareRoles", function () {
42
+ it("user - guest, action - root", function () {
43
+ var res = auth.compareRoles("guest", "root");
44
+ expect(res).to.deep.equal(false);
45
+ });
46
+
47
+ it("user - guest, action - guest", function () {
48
+ var res = auth.compareRoles("guest", "guest");
49
+ expect(res).to.deep.equal(true);
50
+ });
51
+
52
+ it("user - guest, action - [root, admin]", function () {
53
+ var res = auth.compareRoles("guest", ["root", "admin"]);
54
+ expect(res).to.deep.equal(false);
55
+ });
56
+
57
+ it("user - guest, action - [root, admin, guest], strict - false", function () {
58
+ var res = auth.compareRoles(
59
+ "guest",
60
+ ["root", "admin", "guest"],
61
+ false
62
+ );
63
+ expect(res).to.deep.equal(true);
64
+ });
65
+
66
+ it("user - guest, action - [root, admin, guest], strict - true", function () {
67
+ var res = auth.compareRoles("guest", ["root", "admin", "guest"]);
68
+ expect(res).to.deep.equal(false);
69
+ });
70
+
71
+ it("user - [user, notActivated], action - notActivated", function () {
72
+ var res = auth.compareRoles(
73
+ ["user", "notActivated"],
74
+ "notActivated"
75
+ );
76
+ expect(res).to.deep.equal(true);
77
+ });
78
+
79
+ it("user - [user, notActivated, jailed], action - [root, manager]", function () {
80
+ var res = auth.compareRoles(
81
+ ["user", "notActivated", "jailed"],
82
+ ["root", "manager"]
83
+ );
84
+ expect(res).to.deep.equal(false);
85
+ });
86
+ });
87
+
88
+ describe("checkCredentials", function () {
89
+ const rule = {
90
+ admin: true,
91
+ role: "root",
92
+ auth: true,
93
+ };
94
+ it("rule (admin, root, authentificated), auth - true, role - root, admin - true ", function () {
95
+ const res = auth.checkCredentials(rule, true, "root", true);
96
+ expect(res).to.deep.equal(true);
97
+ });
98
+
99
+ it("rule (admin, root, authentificated), auth - true, role - root, admin - false ", function () {
100
+ const res = auth.checkCredentials(rule, true, "root", false);
101
+ expect(res).to.deep.equal(false);
102
+ });
103
+
104
+ it("rule - empty, auth - true, role - root, admin - false ", function () {
105
+ const res = auth.checkCredentials({}, true, "root", false);
106
+ expect(res).to.deep.equal(true);
107
+ });
108
+
109
+ it("rule - null, auth - true, role - root, admin - false ", function () {
110
+ const res = auth.checkCredentials(null, true, "root", false);
111
+ expect(res).to.deep.equal(false);
112
+ });
113
+
114
+ it("rule - (auth), auth - true, role - root, admin - false ", function () {
115
+ const res = auth.checkCredentials(
116
+ { auth: true },
117
+ true,
118
+ "root",
119
+ false
120
+ );
121
+ expect(res).to.deep.equal(true);
122
+ });
123
+
124
+ it("rule - (role: 'notActivated'), auth - true, role - root, admin - false ", function () {
125
+ const res = auth.checkCredentials(
126
+ { role: "notActivated" },
127
+ true,
128
+ "root",
129
+ false
130
+ );
131
+ expect(res).to.deep.equal(false);
132
+ });
133
+
134
+ it("rule - (role: 'user', auth), auth - true, role - user, admin - false ", function () {
135
+ const res = auth.checkCredentials(
136
+ { role: "user", auth: true },
137
+ true,
138
+ "user",
139
+ false
140
+ );
141
+ expect(res).to.deep.equal(true);
142
+ });
143
+
144
+ it("rule - (role: 'user', !auth), auth - false, role - user, admin - false ", function () {
145
+ const res = auth.checkCredentials(
146
+ { role: "user", auth: false },
147
+ false,
148
+ "user",
149
+ false
150
+ );
151
+ expect(res).to.deep.equal(true);
152
+ });
153
+
154
+ it("rule - (role: 'user'), auth - false, role - user, admin - false ", function () {
155
+ const res = auth.checkCredentials(
156
+ { role: "user" },
157
+ false,
158
+ "user",
159
+ false
160
+ );
161
+ expect(res).to.deep.equal(true);
162
+ });
163
+
164
+ it("rule - (auth), auth - true, role - user, admin - false ", function () {
165
+ const res = auth.checkCredentials(
166
+ { auth: true },
167
+ true,
168
+ "user",
169
+ false
170
+ );
171
+ expect(res).to.deep.equal(true);
172
+ });
173
+
174
+ it("rule - (!auth), auth - false, role - user, admin - false ", function () {
175
+ const res = auth.checkCredentials(
176
+ { auth: false },
177
+ false,
178
+ "user",
179
+ false
180
+ );
181
+ expect(res).to.deep.equal(true);
182
+ });
183
+
184
+ it("rule - (auth), auth - false, role - user, admin - false ", function () {
185
+ const res = auth.checkCredentials(
186
+ { auth: true },
187
+ false,
188
+ "user",
189
+ false
190
+ );
191
+ expect(res).to.deep.equal(false);
192
+ });
193
+
194
+ it("rule - (!auth), auth - false, role - user, admin - true ", function () {
195
+ const res = auth.checkCredentials(
196
+ { auth: false },
197
+ false,
198
+ "user",
199
+ true
200
+ );
201
+ expect(res).to.deep.equal(true);
202
+ });
203
+
204
+ it("rule - (admin), auth - false, role - user, admin - true ", function () {
205
+ const res = auth.checkCredentials(
206
+ { admin: true },
207
+ false,
208
+ "user",
209
+ true
210
+ );
211
+ expect(res).to.deep.equal(true);
212
+ });
213
+
214
+ it("rule - (!auth, 'notActivated', false), auth - false, role - notActivated, admin - false ", function () {
215
+ const res = auth.checkCredentials(
216
+ { auth: false, role: "notActivated" },
217
+ false,
218
+ "notActivated",
219
+ false
220
+ );
221
+ expect(res).to.deep.equal(true);
222
+ });
223
+
224
+ it("rule - (!auth, 'notActivated', undefined), auth - false, role - false, admin - false ", function () {
225
+ const res = auth.checkCredentials(
226
+ { auth: false, role: "notActivated" },
227
+ false,
228
+ false,
229
+ false
230
+ );
231
+ expect(res).to.deep.equal(false);
232
+ });
233
+
234
+ it("rule - (admin), auth - false, role - false, admin - true ", function () {
235
+ const res = auth.checkCredentials(
236
+ { admin: true },
237
+ false,
238
+ false,
239
+ true
240
+ );
241
+ expect(res).to.deep.equal(true);
242
+ });
243
+ });
244
+
245
+ describe("checkSupremacy", function () {
246
+ it("Both undefined, order undefined", function () {
247
+ let resultFunction = () => {
248
+ auth.checkSupremacy(undefined, "undefined", undefined);
249
+ };
250
+ expect(resultFunction).to.throw();
251
+ resultFunction = () => {
252
+ auth.checkSupremacy("undefined", undefined, undefined);
253
+ };
254
+ expect(resultFunction).to.throw();
255
+ resultFunction = () => {
256
+ auth.checkSupremacy("undefined", "undefined", undefined);
257
+ };
258
+ expect(resultFunction).to.throw();
259
+ });
260
+
261
+ it("Both undefined, order defined but not Array", function () {
262
+ let resultFunction = () => {
263
+ auth.checkSupremacy("undefined", "undefined", 12);
264
+ };
265
+ expect(resultFunction).to.throw();
266
+ });
267
+
268
+ it("Both undefined, order defined Array with wrong types of element", function () {
269
+ let resultFunction = () => {
270
+ auth.checkSupremacy("undefined", "undefined", [12]);
271
+ };
272
+ expect(resultFunction).to.throw();
273
+ });
274
+
275
+ it("Both undefined, order defined Array with wrong types of element", function () {
276
+ let resultFunction = () => {
277
+ auth.checkSupremacy("undefined", "undefined", [null]);
278
+ };
279
+ expect(resultFunction).to.throw();
280
+ });
281
+
282
+ it("Both undefined, order defined Array with wrong types of element", function () {
283
+ let resultFunction = () => {
284
+ auth.checkSupremacy("undefined", "undefined", [null]);
285
+ };
286
+ expect(resultFunction).to.throw();
287
+ });
288
+
289
+ it("Both defined, order list dont contains roles of sets", function () {
290
+ expect(
291
+ auth.checkSupremacy("undefined", "undefined", ["root"])
292
+ ).to.be.equal(false);
293
+ });
294
+
295
+ it("Various situations with valid input", function () {
296
+ expect(
297
+ auth.checkSupremacy("undefined", "undefined", [
298
+ "root",
299
+ "admin",
300
+ "client",
301
+ "user",
302
+ "guest",
303
+ ])
304
+ ).to.be.equal(false);
305
+ expect(
306
+ auth.checkSupremacy(
307
+ "root",
308
+ ["root"],
309
+ ["root", "admin", "client", "user", "guest"]
310
+ )
311
+ ).to.be.equal(false);
312
+ expect(
313
+ auth.checkSupremacy("undefined", "root", [
314
+ "root",
315
+ "admin",
316
+ "client",
317
+ "user",
318
+ "guest",
319
+ ])
320
+ ).to.be.equal(false);
321
+ expect(
322
+ auth.checkSupremacy("undefined", "guest", [
323
+ "root",
324
+ "admin",
325
+ "client",
326
+ "user",
327
+ "guest",
328
+ ])
329
+ ).to.be.equal(false);
330
+ expect(
331
+ auth.checkSupremacy(
332
+ "root",
333
+ ["undefined", "manager"],
334
+ ["root", "admin", "client", "user", "guest"]
335
+ )
336
+ ).to.be.equal(true);
337
+ expect(
338
+ auth.checkSupremacy("client", "root", [
339
+ "root",
340
+ "admin",
341
+ "client",
342
+ "user",
343
+ "guest",
344
+ ])
345
+ ).to.be.equal(false);
346
+ expect(
347
+ auth.checkSupremacy("client", "client", [
348
+ "root",
349
+ "admin",
350
+ "client",
351
+ "user",
352
+ "guest",
353
+ ])
354
+ ).to.be.equal(false);
355
+ expect(
356
+ auth.checkSupremacy("guest", "guest", [
357
+ "root",
358
+ "admin",
359
+ "client",
360
+ "user",
361
+ "guest",
362
+ ])
363
+ ).to.be.equal(false);
364
+ expect(
365
+ auth.checkSupremacy("guest", "root", [
366
+ "root",
367
+ "admin",
368
+ "client",
369
+ "user",
370
+ "guest",
371
+ ])
372
+ ).to.be.equal(false);
373
+ expect(
374
+ auth.checkSupremacy(
375
+ "client",
376
+ ["root", "guest"],
377
+ ["root", "admin", "client", "user", "guest"]
378
+ )
379
+ ).to.be.equal(false);
380
+ expect(
381
+ auth.checkSupremacy("client", "guest", [
382
+ "root",
383
+ "admin",
384
+ "client",
385
+ "user",
386
+ "guest",
387
+ ])
388
+ ).to.be.equal(true);
389
+ expect(
390
+ auth.checkSupremacy(["admin", "manager"], "guest", [
391
+ "root",
392
+ "admin",
393
+ "client",
394
+ "user",
395
+ "guest",
396
+ ])
397
+ ).to.be.equal(true);
398
+ expect(
399
+ auth.checkSupremacy(["client", "manager"], "client", [
400
+ "root",
401
+ "admin",
402
+ "client",
403
+ "user",
404
+ "guest",
405
+ ])
406
+ ).to.be.equal(false);
407
+ expect(
408
+ auth.checkSupremacy(["admin"], "root", [
409
+ "root",
410
+ "admin",
411
+ "client",
412
+ "user",
413
+ "guest",
414
+ ])
415
+ ).to.be.equal(false);
416
+ expect(
417
+ auth.checkSupremacy("manager", "client", [
418
+ "root",
419
+ "admin",
420
+ "client",
421
+ "user",
422
+ "guest",
423
+ ])
424
+ ).to.be.equal(false);
425
+ expect(
426
+ auth.checkSupremacy("admin", "client", [
427
+ "root",
428
+ "admin",
429
+ "client",
430
+ "user",
431
+ "guest",
432
+ ])
433
+ ).to.be.equal(true);
434
+ });
435
+ });
436
+
437
+ require("./auth/routes.js")({ Auth: auth, HttpError, expect });
438
+ require("./auth/roles.js")({ Auth: auth, HttpError, expect });
439
+ require("./auth/rules.js")({ Auth: auth, HttpError, expect });
440
+ require("./auth/session.js")({ Auth: auth, HttpError, expect });
441
+ require("./auth/obsolete.js")({ Auth: auth, HttpError, expect });
442
+ require("./auth/fields.js")({ Auth: auth, HttpError, expect });
230
443
  });