1- var downloader = require ( './../build/downloader' ) ;
2- var assert = require ( 'assert' ) ;
3- var os = require ( 'os' ) ;
4- var path = require ( 'path' ) ;
1+ const downloader = require ( './../build/downloader' ) ;
2+ const assert = require ( 'assert' ) ;
3+ const os = require ( 'os' ) ;
4+ const path = require ( 'path' ) ;
55
66describe ( 'Downloader' , function ( ) {
77 it ( 'should download a file correctly' , function ( done ) {
8- var destinationPath = path . join ( os . tmpdir ( ) , "test_" + Math . round ( Math . random ( ) * 10000 ) ) ;
8+ const destinationPath = path . join ( os . tmpdir ( ) , "test_" + Math . round ( Math . random ( ) * 10000 ) ) ;
99 downloader . get ( 'https://testingbot.com/assets/about.png' , { destination : destinationPath } , function ( err , downloadedFilePath ) {
1010 assert . equal ( err , null ) ;
1111 assert . equal ( downloadedFilePath , destinationPath ) ;
@@ -14,7 +14,7 @@ describe('Downloader', function() {
1414 } ) ;
1515
1616 it ( 'should return an error when a download fails (bad http code)' , function ( done ) {
17- var destinationPath = path . join ( os . tmpdir ( ) , "test_" + Math . round ( Math . random ( ) * 10000 ) ) ;
17+ const destinationPath = path . join ( os . tmpdir ( ) , "test_" + Math . round ( Math . random ( ) * 10000 ) ) ;
1818 downloader . get ( 'https://testingbot.com/assets/this_does_not_exist.png' , { destination : destinationPath } , function ( err , downloadedFilePath ) {
1919 assert . notEqual ( err , null ) ;
2020 assert . equal ( downloadedFilePath , null ) ;
0 commit comments