Skip to content
Merged
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
15 changes: 4 additions & 11 deletions test/uploader_spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -114,31 +114,24 @@ describe("uploader", function () {
});

describe("remote urls ", function () {
var writeSpy;
writeSpy = void 0;
beforeEach(function () {
writeSpy = sinon.spy(ClientRequest.prototype, 'write');
});
afterEach(function () {
writeSpy.restore();
});
const mocked = helper.mockTest();
it("should send s3:// URLs to server", function () {
cloudinary.v2.uploader.upload("s3://test/1.jpg", {
tags: UPLOAD_TAGS,
});
sinon.assert.calledWith(writeSpy, sinon.match(helper.uploadParamMatcher('file', "s3://test/1.jpg")));
sinon.assert.calledWith(mocked.write, sinon.match(helper.uploadParamMatcher('file', "s3://test/1.jpg")));
});
it("should send gs:// URLs to server", function () {
cloudinary.v2.uploader.upload("gs://test/1.jpg", {
tags: UPLOAD_TAGS,
});
sinon.assert.calledWith(writeSpy, sinon.match(helper.uploadParamMatcher('file', "gs://test/1.jpg")));
sinon.assert.calledWith(mocked.write, sinon.match(helper.uploadParamMatcher('file', "gs://test/1.jpg")));
});
it("should send ftp:// URLs to server", function () {
cloudinary.v2.uploader.upload("ftp://example.com/1.jpg", {
tags: UPLOAD_TAGS,
});
sinon.assert.calledWith(writeSpy, sinon.match(helper.uploadParamMatcher('file', "ftp://example.com/1.jpg")));
sinon.assert.calledWith(mocked.write, sinon.match(helper.uploadParamMatcher('file', "ftp://example.com/1.jpg")));
});
});

Expand Down