diff --git a/test/app-test-definitions.js b/test/app-test-definitions.js index d6014cf..5986b75 100644 --- a/test/app-test-definitions.js +++ b/test/app-test-definitions.js @@ -566,6 +566,31 @@ const tests = [ result.type.should.be.equal('resolved'); JSON.parse(result.data.data).url.should.be.equal('https://httpbin.org/anything?query key=very long query value with spaces'); } + }, + { + description: 'should download a file from given HTTPS URL to given path in local filesystem #197', + expected: 'resolved: {"content": "\\n\\n" ...', + func: function(resolve, reject) { + var sourceUrl = 'https://httpbin.org/xml'; + var targetPath = cordova.file.cacheDirectory + 'test.xml'; + + cordova.plugin.http.downloadFile(sourceUrl, {}, {}, targetPath, function(entry) { + helpers.getWithXhr(function(content) { + resolve({ + sourceUrl: sourceUrl, + targetPath: targetPath, + fullPath: entry.fullPath, + name: entry.name, + content: content + }); + }, targetPath); + }, reject); + }, + validationFunc: function(driver, result) { + result.type.should.be.equal('resolved'); + result.data.name.should.be.equal('test.xml'); + result.data.content.should.be.equal("\n\n\n\n\n\n \n \n Wake up to WonderWidgets!\n \n\n \n \n Overview\n Why WonderWidgets are great\n \n Who buys WonderWidgets\n \n\n"); + } } ];