ellipsis-api
Advanced tools
Comparing version 0.0.11 to 0.0.12
@@ -215,2 +215,28 @@ "use strict"; | ||
describe("generateToken", () => { | ||
it("sends an appropriate api request", () => { | ||
expect.assertions(2); | ||
const expirySeconds = 300; | ||
const isOneTime = true; | ||
const options = Object.assign({}, { | ||
expirySeconds: expirySeconds, | ||
isOneTime: isOneTime | ||
}); | ||
return actionsApi.generateToken(options).then(body => { | ||
const form = body.form; | ||
const expectedForm = Object.assign({}, { token: ellipsis.token }, { | ||
expirySeconds: options.expirySeconds, | ||
isOneTime: options.isOneTime | ||
}); | ||
expect(form).toEqual(expectedForm); | ||
expect(request.post.mock.calls[0][0].url).toEqual(actionsApi.urlFor("v1/tokens")); | ||
}); | ||
}); | ||
}); | ||
}); | ||
@@ -217,0 +243,0 @@ |
18
index.js
@@ -172,2 +172,20 @@ const request = require('request'); | ||
generateToken(options) { | ||
return new Promise((resolve, reject) => { | ||
const mergedOptions = Object.assign({}, options, { | ||
success: resolve, | ||
error: reject | ||
}); | ||
const formData = { | ||
expirySeconds: mergedOptions.expirySeconds, | ||
isOneTime: mergedOptions.isOneTime, | ||
token: this.token() | ||
}; | ||
request.post({ | ||
url: this.urlFor("v1/tokens"), | ||
form: formData | ||
}, (error, response, body) => this.handleResponse(mergedOptions, error, response, body)); | ||
}); | ||
} | ||
} | ||
@@ -174,0 +192,0 @@ |
{ | ||
"name": "ellipsis-api", | ||
"version": "0.0.11", | ||
"version": "0.0.12", | ||
"description": "Interact with Ellipsis skills & actions", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
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
New author
Supply chain riskA new npm collaborator published a version of the package for the first time. New collaborators are usually benign additions to a project, but do indicate a change to the security surface area of a package.
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
21300
531
1