diff --git a/lib/Repository.js b/lib/Repository.js index 3908775c..daf9443f 100644 --- a/lib/Repository.js +++ b/lib/Repository.js @@ -749,6 +749,7 @@ class Repository extends Requestable { * @return {Promise} - the promise for the http request */ writeFile(branch, path, content, message, options, cb) { + options = options || {}; if (typeof options === 'function') { cb = options; options = {}; diff --git a/test/repository.spec.js b/test/repository.spec.js index 3de25bef..7102874b 100644 --- a/test/repository.spec.js +++ b/test/repository.spec.js @@ -385,6 +385,16 @@ describe('Repository', function() { })); }); + it('should successfully write to repo when not providing optional options argument', function(done) { + const promise = remoteRepo.writeFile('master', fileName, initialText, initialMessage); + promise.then(() => remoteRepo.getContents('master', fileName, 'raw', + assertSuccessful(done, function(err, fileText) { + expect(fileText).to.be(initialText); + + done(); + }))) + }); + it('should rename files', function(done) { remoteRepo.writeFile('master', fileName, initialText, initialMessage, assertSuccessful(done, function() { wait()().then(() => remoteRepo.move('master', fileName, 'new_name', assertSuccessful(done, function() {
Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.
Alternative Proxies: