1- " use strict" ;
1+ ' use strict' ;
22
3- var fs = require ( "fs" ) ;
4- var expect = require ( " expect" ) ;
3+ var fs = require ( 'fs' ) ;
4+ var expect = require ( ' expect' ) ;
55
6- var FileCache = require ( " keyv-file" ) . KeyvFile ;
6+ var FileCache = require ( ' keyv-file' ) . KeyvFile ;
77
8- var { Downloader } = require ( " ../" ) ;
8+ var { Downloader } = require ( ' ../' ) ;
99
10- describe ( " github-download-directory" , function ( ) {
10+ describe ( ' github-download-directory' , function ( ) {
1111 function getPath ( file ) {
1212 return file . path ;
1313 }
1414
1515 function onlyIndex ( file ) {
16- return file . path === " index.js" ;
16+ return file . path === ' index.js' ;
1717 }
1818
19- describe ( " fetchFiles" , function ( ) {
19+ describe ( ' fetchFiles' , function ( ) {
2020 this . timeout ( 0 ) ;
2121
2222 // Not testing the singleton so we can auth
2323 const downloader = new Downloader ( {
2424 github : { auth : process . env . TEST_TOKEN } ,
2525 } ) ;
2626
27- it ( " fetchs the files" , async function ( ) {
27+ it ( ' fetchs the files' , async function ( ) {
2828 var files = await downloader . fetchFiles (
29- " phated" ,
30- " github-download-directory" ,
31- ""
29+ ' phated' ,
30+ ' github-download-directory' ,
31+ ''
3232 ) ;
3333 var paths = files . map ( getPath ) ;
3434 // Check a few paths
35- expect ( paths ) . toContain ( " index.js" ) ;
36- expect ( paths ) . toContain ( " LICENSE" ) ;
37- expect ( paths ) . toContain ( " README.md" ) ;
38- expect ( paths ) . toContain ( " package.json" ) ;
35+ expect ( paths ) . toContain ( ' index.js' ) ;
36+ expect ( paths ) . toContain ( ' LICENSE' ) ;
37+ expect ( paths ) . toContain ( ' README.md' ) ;
38+ expect ( paths ) . toContain ( ' package.json' ) ;
3939 } ) ;
4040
41- it ( " filters the directory" , async function ( ) {
41+ it ( ' filters the directory' , async function ( ) {
4242 var files = await downloader . fetchFiles (
43- " phated" ,
44- " github-download-directory" ,
45- " bin"
43+ ' phated' ,
44+ ' github-download-directory' ,
45+ ' bin'
4646 ) ;
4747 var paths = files . map ( getPath ) ;
4848 // Just the bin file
49- expect ( paths ) . toEqual ( [ " bin/github-download-directory.js" ] ) ;
49+ expect ( paths ) . toEqual ( [ ' bin/github-download-directory.js' ] ) ;
5050 } ) ;
5151
52- it ( " uses the cache values if available" , async function ( ) {
53- var key = " phated/github-download-directory#master" ;
52+ it ( ' uses the cache values if available' , async function ( ) {
53+ var key = ' phated/github-download-directory#master' ;
5454 var cachedTree = await downloader . cache . get ( key ) ;
5555 await downloader . cache . set ( key , cachedTree . filter ( onlyIndex ) ) ;
5656
5757 var files = await downloader . fetchFiles (
58- " phated" ,
59- " github-download-directory" ,
60- ""
58+ ' phated' ,
59+ ' github-download-directory' ,
60+ ''
6161 ) ;
6262 var paths = files . map ( getPath ) ;
6363 // Check it only contains index.js, which we set
64- expect ( paths ) . toEqual ( [ " index.js" ] ) ;
64+ expect ( paths ) . toEqual ( [ ' index.js' ] ) ;
6565 } ) ;
6666
67- it ( " reuses the cache between runs" , async function ( ) {
67+ it ( ' reuses the cache between runs' , async function ( ) {
6868 var files = await downloader . fetchFiles (
69- " phated" ,
70- " github-download-directory" ,
71- ""
69+ ' phated' ,
70+ ' github-download-directory' ,
71+ ''
7272 ) ;
7373 var paths = files . map ( getPath ) ;
7474 // Check it only contains index.js, which we set
75- expect ( paths ) . toEqual ( [ " index.js" ] ) ;
75+ expect ( paths ) . toEqual ( [ ' index.js' ] ) ;
7676 } ) ;
7777
78- it ( " uses cache keys that include the SHA" , async function ( ) {
78+ it ( ' uses cache keys that include the SHA' , async function ( ) {
7979 var files = await downloader . fetchFiles (
80- " phated" ,
81- " github-download-directory" ,
82- "" ,
80+ ' phated' ,
81+ ' github-download-directory' ,
82+ '' ,
8383 {
84- sha : " 773c2f0f26fffeaecc1651102da1fd18098309c7" ,
84+ sha : ' 773c2f0f26fffeaecc1651102da1fd18098309c7' ,
8585 }
8686 ) ;
8787 var paths = files . map ( getPath ) ;
8888 // Ensure we have a fresh set of files
89- expect ( paths ) . toContain ( " index.js" ) ;
90- expect ( paths ) . toContain ( " LICENSE" ) ;
91- expect ( paths ) . toContain ( " README.md" ) ;
92- expect ( paths ) . toContain ( " package.json" ) ;
89+ expect ( paths ) . toContain ( ' index.js' ) ;
90+ expect ( paths ) . toContain ( ' LICENSE' ) ;
91+ expect ( paths ) . toContain ( ' README.md' ) ;
92+ expect ( paths ) . toContain ( ' package.json' ) ;
9393 } ) ;
9494 } ) ;
9595
96- describe ( " Downloader" , function ( ) {
97- it ( " allows you to construct an new instance with custom cache" , async function ( ) {
98- var filename = " test/.cache.json" ;
96+ describe ( ' Downloader' , function ( ) {
97+ it ( ' allows you to construct an new instance with custom cache' , async function ( ) {
98+ var filename = ' test/.cache.json' ;
9999
100100 var store = new FileCache ( { filename } ) ;
101101
@@ -105,17 +105,17 @@ describe("github-download-directory", function () {
105105 } ) ;
106106
107107 var files = await downloader . fetchFiles (
108- " phated" ,
109- " github-download-directory" ,
110- ""
108+ ' phated' ,
109+ ' github-download-directory' ,
110+ ''
111111 ) ;
112112
113113 var paths = files . map ( getPath ) ;
114114 // Check a few paths
115- expect ( paths ) . toContain ( " index.js" ) ;
116- expect ( paths ) . toContain ( " LICENSE" ) ;
117- expect ( paths ) . toContain ( " README.md" ) ;
118- expect ( paths ) . toContain ( " package.json" ) ;
115+ expect ( paths ) . toContain ( ' index.js' ) ;
116+ expect ( paths ) . toContain ( ' LICENSE' ) ;
117+ expect ( paths ) . toContain ( ' README.md' ) ;
118+ expect ( paths ) . toContain ( ' package.json' ) ;
119119 // Make sure the file cache exists
120120 expect ( fs . existsSync ( filename ) ) . toEqual ( true ) ;
121121 } ) ;
0 commit comments