diff --git a/test/uploader_spec.js b/test/uploader_spec.js index 27b7117d..1943ae7a 100644 --- a/test/uploader_spec.js +++ b/test/uploader_spec.js @@ -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"))); }); });