Skip to content

Commit c263423

Browse files
author
Eran Hammer
committed
Dependencies (incomplete). Closes hapijs#2452. Closes hapijs#2454. Closes hapijs#2455. Closes hapijs#2457. For hapijs#2453
1 parent 88a2710 commit c263423

File tree

6 files changed

+18
-18
lines changed

6 files changed

+18
-18
lines changed

lib/schema.js

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ internals.routeBase = Joi.object({
5858
expiresIn: Joi.number(),
5959
expiresAt: Joi.string(),
6060
privacy: Joi.string().valid('default', 'public', 'private'),
61-
statuses: Joi.array().min(1).includes(Joi.number().integer().min(200))
61+
statuses: Joi.array().items(Joi.number().integer().min(200)).min(1)
6262
}),
6363
cors: Joi.object({
6464
origin: Joi.array(),
@@ -170,7 +170,7 @@ internals.server = Joi.object({
170170
cache: Joi.alternatives([
171171
Joi.func(),
172172
internals.cache,
173-
Joi.array().includes(internals.cache).min(1)
173+
Joi.array().items(internals.cache).min(1)
174174
]).allow(null),
175175
connections: internals.connectionBase,
176176
debug: Joi.object({
@@ -191,7 +191,7 @@ internals.connection = internals.connectionBase.keys({
191191
autoListen: Joi.boolean(),
192192
host: Joi.string().hostname(),
193193
address: Joi.string().hostname(),
194-
labels: Joi.array().includes(Joi.string()).single(),
194+
labels: Joi.array().items(Joi.string()).single(),
195195
listener: Joi.any(),
196196
port: Joi.alternatives([
197197
Joi.number().integer().min(0), // TCP port
@@ -209,7 +209,7 @@ internals.connection = internals.connectionBase.keys({
209209

210210
internals.vhost = Joi.alternatives([
211211
Joi.string().hostname(),
212-
Joi.array().includes(Joi.string().hostname()).min(1)
212+
Joi.array().items(Joi.string().hostname()).min(1)
213213
]);
214214

215215

@@ -236,7 +236,7 @@ internals.pre = [
236236

237237
internals.routeConfig = internals.routeBase.keys({
238238
id: Joi.string(),
239-
pre: Joi.array().includes(internals.pre.concat(Joi.array().includes(internals.pre).min(1))),
239+
pre: Joi.array().items(internals.pre.concat(Joi.array().items(internals.pre).min(1))),
240240
handler: [
241241
Joi.func(),
242242
Joi.string(),
@@ -245,11 +245,11 @@ internals.routeConfig = internals.routeBase.keys({
245245
description: Joi.string(),
246246
notes: [
247247
Joi.string(),
248-
Joi.array().includes(Joi.string())
248+
Joi.array().items(Joi.string())
249249
],
250250
tags: [
251251
Joi.string(),
252-
Joi.array().includes(Joi.string())
252+
Joi.array().items(Joi.string())
253253
]
254254
});
255255

@@ -275,7 +275,7 @@ internals.register = Joi.object({
275275
prefix: Joi.string().regex(/^\/.+/),
276276
vhost: internals.vhost
277277
}),
278-
select: Joi.array().includes(Joi.string()).single()
278+
select: Joi.array().items(Joi.string()).single()
279279
});
280280

281-
internals.dependencies = Joi.array().includes(Joi.string()).single();
281+
internals.dependencies = Joi.array().items(Joi.string()).single();

npm-shrinkwrap.json

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@
3131
"inert": "2.x.x",
3232
"iron": "2.x.x",
3333
"items": "1.x.x",
34-
"joi": "5.x.x",
34+
"joi": "6.x.x",
3535
"kilt": "^1.1.x",
3636
"mimos": "2.x.x",
3737
"peekaboo": "1.x.x",

test/plugin.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -826,7 +826,7 @@ describe('Plugin', function () {
826826
expect(function () {
827827

828828
server.register(a, function () {});
829-
}).to.throw('Invalid dependencies options (must be a string or an array of strings) {\n \"b\": true,\n \u001b[41m\"0\"\u001b[0m\u001b[31m [1]: -- missing --\u001b[0m\n}\n\u001b[31m\n[1] single value of value fails because value must be a string\u001b[0m');
829+
}).to.throw('Invalid dependencies options (must be a string or an array of strings) {\n \"b\": true,\n \u001b[41m\"0\"\u001b[0m\u001b[31m [1]: -- missing --\u001b[0m\n}\n\u001b[31m\n[1] "0" must be a string\u001b[0m');
830830
done();
831831
});
832832

@@ -847,7 +847,7 @@ describe('Plugin', function () {
847847
expect(function () {
848848

849849
server.register(a, function () {});
850-
}).to.throw('Invalid dependencies options (must be a string or an array of strings) [\n null\n]\n\u001b[31m\n[1] value at position 0 fails because value must be a string\u001b[0m');
850+
}).to.throw('Invalid dependencies options (must be a string or an array of strings) [\n null\n]\n\u001b[31m\n[1] "0" must be a string\u001b[0m');
851851
done();
852852
});
853853
});

test/route.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ describe('Route', function () {
4949
var server = new Hapi.Server();
5050
server.connection();
5151
server.route({ path: '/', handler: function () { } });
52-
}).to.throw(/method is required/);
52+
}).to.throw(/"method" is required/);
5353
done();
5454
});
5555

test/validation.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -473,7 +473,7 @@ describe('validation', function () {
473473
server.inject('/?a=1', function (res) {
474474

475475
expect(res.statusCode).to.equal(200);
476-
expect(res.result.data.output.payload.message).to.deep.equal('a length must be at least 2 characters long');
476+
expect(res.result.data.output.payload.message).to.deep.equal('child "a" fails because ["a" length must be at least 2 characters long]');
477477
done();
478478
});
479479
});
@@ -561,7 +561,7 @@ describe('validation', function () {
561561
expect(res.result).to.deep.equal({
562562
statusCode: 400,
563563
error: 'Bad Request',
564-
message: 'a length must be at least 2 characters long',
564+
message: 'child "a" fails because ["a" length must be at least 2 characters long]',
565565
validation: {
566566
source: 'query',
567567
keys: ['a']
@@ -1000,7 +1000,7 @@ describe('validation', function () {
10001000
},
10011001
handler: handler
10021002
});
1003-
}).to.throw(/modify conflict with forbidden peer sample/);
1003+
}).to.throw(/"modify" conflict with forbidden peer "sample"/);
10041004
done();
10051005
});
10061006

@@ -1289,7 +1289,7 @@ describe('validation', function () {
12891289
server.on('request-internal', function (request, event, tags) {
12901290

12911291
if (tags.validation) {
1292-
expect(event.data).to.equal('a is not allowed');
1292+
expect(event.data).to.equal('"a" is not allowed');
12931293
}
12941294
});
12951295

0 commit comments

Comments
 (0)