Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Chore: Remove code supporting token in options object #268

Merged
merged 2 commits into from
Aug 15, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 1 addition & 3 deletions src/lib/Preview.js
Original file line number Diff line number Diff line change
Expand Up @@ -149,16 +149,14 @@ class Preview extends EventEmitter {
* Primary function for showing a preview of a file.
*
* @param {string} fileId - Box File ID
* @param {string|Function} token - auth token string or generator function
* @param {string|Function} token - Access token string or generator function
* @param {Object} [options] - Optional preview options
* @return {void}
*/
show(fileId, token, options = {}) {
// Save a reference to the options to be used later
if (typeof token === 'string' || typeof token === 'function') {
this.previewOptions = Object.assign({}, options, { token });
} else if (token) {
this.previewOptions = Object.assign({}, token || {});
} else {
throw new Error('Missing access token!');
}
Expand Down
2 changes: 1 addition & 1 deletion src/lib/__tests__/Preview-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@ describe('lib/Preview', () => {
const spy = sandbox.spy(preview, 'show');

try {
preview.show('file');
preview.show('file', {});
} catch (e) {
expect(spy.threw());
expect(e.message).to.equal('Missing access token!');
Expand Down