@scoir/filestack
Advanced tools
Comparing version 2.0.1 to 2.2.0
@@ -34,2 +34,7 @@ 'use strict'; | ||
}, | ||
exportUrl: function exportUrl(url, opts) { | ||
return new _promise2.default(function (resolve) { | ||
filestack.exportFile(url, opts, resolve, resolve); | ||
}); | ||
}, | ||
pickAndStore: function pickAndStore(pickerOptions, storeOptions) { | ||
@@ -36,0 +41,0 @@ return new _promise2.default(function (resolve, reject) { |
@@ -19,2 +19,7 @@ import filestackFileExtensions from './file-extensions' | ||
}, | ||
exportUrl: (url, opts) => { | ||
return new Promise(resolve => { | ||
filestack.exportFile(url, opts, resolve, resolve); | ||
}); | ||
}, | ||
pickAndStore: (pickerOptions, storeOptions) => { | ||
@@ -21,0 +26,0 @@ return new Promise((resolve, reject) => { |
@@ -24,2 +24,3 @@ import filepickerFactory, { fileExtensions } from './index'; | ||
export: expect.any(Function), | ||
exportUrl: expect.any(Function), | ||
pickAndStore: expect.any(Function), | ||
@@ -98,2 +99,25 @@ makeDropPane: expect.any(Function), | ||
}); | ||
describe('# exportUrl', () => { | ||
let filestack; | ||
beforeEach(() => { | ||
filestack = createFilepicker() | ||
}) | ||
it('should upload the specified file with options', () => { | ||
filestack.exportUrl('url', {with: 'options'}); | ||
expect(filestackInstance.exportFile).toHaveBeenCalledWith( | ||
'url', | ||
{with: 'options'}, | ||
expect.any(Function), | ||
expect.any(Function), | ||
); | ||
}) | ||
it('should return a promise that resolves with filestack\'s onSuccess', async () => { | ||
const spy = jest.fn() | ||
const result = filestack.exportUrl(); | ||
result.then(spy); | ||
filestackInstance.exportFile.mock.calls[0][2]('result'); | ||
await result; | ||
expect(spy).toHaveBeenCalledWith('result'); | ||
}) | ||
}); | ||
describe('# pickAndStore', () => { | ||
@@ -100,0 +124,0 @@ let filestack; |
{ | ||
"name": "@scoir/filestack", | ||
"version": "2.0.1", | ||
"version": "2.2.0", | ||
"description": "", | ||
@@ -5,0 +5,0 @@ "author": "@scoir", |
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
9735
238
1