Skip to content
This repository was archived by the owner on Feb 11, 2022. It is now read-only.

Commit 949a6fb

Browse files
committed
fix(dependencies): bumped to the latest version of joi
1 parent 2de82cd commit 949a6fb

File tree

5 files changed

+145
-24
lines changed

5 files changed

+145
-24
lines changed

package-lock.json

+132-2
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

+2-1
Original file line numberDiff line numberDiff line change
@@ -75,18 +75,19 @@
7575
"nyc": "^14.1.1",
7676
"proxyquire": "^2.1.3",
7777
"rollup": "^1.20.3",
78+
"rollup-plugin-auto-external": "^2.0.0",
7879
"rollup-plugin-babel": "^3.0.7",
7980
"rollup-plugin-node-resolve": "^5.2.0",
8081
"sinon": "^7.4.2"
8182
},
8283
"dependencies": {
84+
"@hapi/joi": "^16.1.1",
8385
"@octokit/rest": "^16.28.9",
8486
"boom": "^7.3.0",
8587
"btoa": "1.2.1",
8688
"delay": "^4.3.0",
8789
"hoek": "^6.1.3",
8890
"http-status-codes": "1.3.2",
89-
"joi": "^14.3.1",
9091
"lodash.groupby": "4.6.0",
9192
"lodash.values": "4.3.0"
9293
}

rollup.config.js

+2-8
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,12 @@
11
/* eslint import/no-extraneous-dependencies: ["error", {"devDependencies": true}] */
22
import babel from 'rollup-plugin-babel';
33
import nodeResolve from 'rollup-plugin-node-resolve';
4+
import autoExternal from 'rollup-plugin-auto-external';
45

56
export default {
67
input: 'src/plugin.js',
7-
external: [
8-
'http-status-codes',
9-
'delay',
10-
'joi',
11-
'hoek',
12-
'boom',
13-
'@octokit/rest'
14-
],
158
plugins: [
9+
autoExternal(),
1610
nodeResolve({
1711
module: true,
1812
jsnext: true

src/plugin.js

+4-3
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,13 @@
1-
import * as joi from 'joi';
1+
import * as joi from '@hapi/joi';
22
import hoek from 'hoek';
33
import validatePayloadAndProcess from './handler';
44

55
function validate(options) {
6-
const validated = joi.validate(options, joi.object({
6+
const schema = joi.object({
77
github: joi.object({token: joi.string().required()}).required(),
88
acceptAction: joi.string().valid('merge', 'squash', 'rebase').required()
9-
}).required());
9+
}).required();
10+
const validated = schema.validate(options);
1011

1112
hoek.assert(!validated.error, validated.error);
1213

test/unit/plugin-test.js

+5-10
Original file line numberDiff line numberDiff line change
@@ -60,35 +60,30 @@ suite('plugin', () => {
6060

6161
test('that an error is thrown if the github config is not an object', () => assert.isRejected(
6262
plugin.register({}, {github: ''}, next),
63-
'"github" must be an object'
63+
'"github" must be of type object'
6464
));
6565

6666
test('that an error is thrown if the github token is not provided', () => assert.isRejected(
6767
plugin.register({}, {github: {}}, next),
68-
'"token" is required'
68+
'"github.token" is required'
6969
));
7070

7171
test('that an error is thrown if the github token is an inappropriate type', () => assert.isRejected(
7272
plugin.register({}, {github: {token: any.integer()}}, next),
73-
'"token" must be a string'
73+
'"github.token" must be a string'
7474
));
7575

7676
test(
7777
'that an error is thrown if the `acceptAction` setting is not provided',
7878
() => assert.isRejected(
7979
plugin.register({}, {github: {token: any.string()}}, next),
80-
'child "acceptAction" fails because ["acceptAction" is required]'
80+
'"acceptAction" is required'
8181
)
8282
);
8383

84-
test('that an error is thrown if the accept-action is not provided as an appropriate type', () => assert.isRejected(
85-
plugin.register({}, {github: {token: any.string()}, acceptAction: any.integer()}, next),
86-
'child "acceptAction" fails because ["acceptAction" must be a string]'
87-
));
88-
8984
test('that an error is thrown if an invalid accept-action is not provided', () => assert.isRejected(
9085
plugin.register({}, {github: {token: any.string()}, acceptAction: any.string()}, next),
91-
'child "acceptAction" fails because ["acceptAction" must be one of [merge, squash, rebase]]'
86+
'"acceptAction" must be one of [merge, squash, rebase]'
9287
));
9388

9489
test('that no error is thrown if a valid accept-type is provided', () => Promise.all([

0 commit comments

Comments
 (0)