-
Notifications
You must be signed in to change notification settings - Fork 322
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: auto_chaptering on upload and explicit support (#689)
- Loading branch information
1 parent
61edd35
commit 7deaf1b
Showing
3 changed files
with
39 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
const assert = require('assert'); | ||
const sinon = require('sinon'); | ||
|
||
const cloudinary = require('../../../../lib/cloudinary'); | ||
const createTestConfig = require('../../../testUtils/createTestConfig'); | ||
const helper = require('../../../spechelper'); | ||
const ClientRequest = require('_http_client').ClientRequest; | ||
|
||
describe('Uploader', () => { | ||
let spy; | ||
let xhr; | ||
|
||
before(() => { | ||
xhr = sinon.useFakeXMLHttpRequest(); | ||
spy = sinon.spy(ClientRequest.prototype, 'write'); | ||
}); | ||
|
||
after(() => { | ||
spy.restore(); | ||
xhr.restore(); | ||
}); | ||
|
||
describe('upload', () => { | ||
it('should send a request with auto_chaptering set to true if requested', () => { | ||
cloudinary.v2.uploader.upload('irrelevant', { auto_chaptering: true }); | ||
sinon.assert.calledWith(spy, sinon.match(helper.uploadParamMatcher('auto_chaptering', '1'))); | ||
}); | ||
}); | ||
|
||
describe('explicit', () => { | ||
it('should send a request with auto_chaptering set to true if requested', () => { | ||
cloudinary.v2.uploader.explicit('irrelevant', { auto_chaptering: true }); | ||
sinon.assert.calledWith(spy, sinon.match(helper.uploadParamMatcher('auto_chaptering', '1'))); | ||
}); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters