@octokit/plugin-enterprise-compatibility
Advanced tools
Comparing version 1.0.0 to 1.1.0
48
index.js
@@ -5,29 +5,31 @@ module.exports = octokitEnterpriseCompatibility | ||
// see https://github.com/octokit/rest.js/blob/15.x/lib/routes.json#L3046-L3068 | ||
const addOrReplaceLabelsOptions = { | ||
params: { | ||
labels: { | ||
required: true, | ||
type: 'string[]', | ||
mapTo: 'data' | ||
}, | ||
number: { | ||
required: true, | ||
type: 'integer' | ||
}, | ||
owner: { | ||
required: true, | ||
type: 'string' | ||
}, | ||
repo: { | ||
required: true, | ||
type: 'string' | ||
} | ||
}, | ||
url: '/repos/:owner/:repo/issues/:number/labels' | ||
} | ||
octokit.registerEndpoints({ | ||
issues: { | ||
addLabels: { | ||
method: 'POST', | ||
params: { | ||
labels: { | ||
required: true, | ||
type: 'string[]', | ||
mapTo: 'data' | ||
}, | ||
number: { | ||
required: true, | ||
type: 'integer' | ||
}, | ||
owner: { | ||
required: true, | ||
type: 'string' | ||
}, | ||
repo: { | ||
required: true, | ||
type: 'string' | ||
} | ||
}, | ||
url: '/repos/:owner/:repo/issues/:number/labels' | ||
} | ||
addLabels: Object.assign({ method: 'POST' }, addOrReplaceLabelsOptions), | ||
replaceLabels: Object.assign({ method: 'PUT' }, addOrReplaceLabelsOptions) | ||
} | ||
}) | ||
} |
{ | ||
"name": "@octokit/plugin-enterprise-compatibility", | ||
"version": "1.0.0", | ||
"version": "1.1.0", | ||
"publishConfig": { | ||
@@ -38,11 +38,11 @@ "access": "public", | ||
"devDependencies": { | ||
"@octokit/rest": "^16.7.0", | ||
"@octokit/rest": "^16.13.3", | ||
"coveralls": "^3.0.2", | ||
"nock": "^10.0.6", | ||
"semantic-release": "^15.10.7", | ||
"semantic-release": "^15.13.3", | ||
"standard": "^12.0.1", | ||
"standard-markdown": "^5.0.1", | ||
"tap": "^12.0.1" | ||
"tap": "^12.4.0" | ||
}, | ||
"dependencies": {} | ||
} |
@@ -19,3 +19,3 @@ # plugin-enterprise-compatibility.js | ||
const Octokit = require('@octokit/rest') | ||
.plugin(require('@octokit/enterprise-compatibility')) | ||
.plugin(require('@octokit/plugin-enterprise-compatibility')) | ||
const octokit = new Octokit() | ||
@@ -22,0 +22,0 @@ |
30
test.js
@@ -6,2 +6,8 @@ const nock = require('nock') | ||
test('does leave other endpoints in tact', t => { | ||
const octokit = Octokit.plugin(require('.'))({ baseUrl: 'https://patched.test' }) | ||
t.ok(octokit.issues.get.endpoint) | ||
t.end() | ||
}) | ||
test('octokit.issues.addLabels() sends labels in request body', t => { | ||
@@ -30,1 +36,25 @@ const octokitOriginal = Octokit({ baseUrl: 'https://original.test' }) | ||
}) | ||
test('octokit.issues.replaceLabels() sends labels in request body', t => { | ||
const octokitOriginal = Octokit({ baseUrl: 'https://original.test' }) | ||
const octokitPatched = Octokit.plugin(require('.'))({ baseUrl: 'https://patched.test' }) | ||
nock('https://original.test') | ||
.put('/repos/octokit/rest.js/issues/1/labels', { labels: [ 'foo', 'bar' ] }) | ||
.reply(200, {}) | ||
nock('https://patched.test') | ||
.put('/repos/octokit/rest.js/issues/1/labels', [ 'foo', 'bar' ]) | ||
.reply(200, {}) | ||
const options = { | ||
owner: 'octokit', | ||
repo: 'rest.js', | ||
number: 1, | ||
labels: ['foo', 'bar'] | ||
} | ||
return Promise.all([ | ||
octokitOriginal.issues.replaceLabels(options), | ||
octokitPatched.issues.replaceLabels(options) | ||
]) | ||
}) |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
11077
80