@@ -11,3 +11,31 @@ test('generateFilePaths works', async () => {
11
11
} ) ;
12
12
expect ( results ) . toMatchSnapshot ( ) ;
13
13
} ) ;
14
+
15
+ const pathInResults = ( expectedPath , results ) => {
16
+ return results . findIndex ( ( r ) => r . endsWith ( expectedPath ) ) != - 1 ;
17
+ } ;
18
+
19
+ test ( "ignoreDirectories works including leading slash" , async ( ) => {
20
+ const results = await pluginCore . generateFilePaths ( {
21
+ fileAndDirPaths : [ "/" ] ,
22
+ ignoreDirectories : [ "/admin" ] ,
23
+ PUBLISH_DIR ,
24
+ } ) ;
25
+ expect ( pathInResults ( "publishDir/blog/post1.html" , results ) ) . toBe ( true ) ;
26
+ expect ( pathInResults ( "publishDir/about.html" , results ) ) . toBe ( true ) ;
27
+ expect ( pathInResults ( "publishDir/index.html" , results ) ) . toBe ( true ) ;
28
+ expect ( pathInResults ( "publishDir/admin/index.html" , results ) ) . toBe ( false ) ;
29
+ } ) ;
30
+
31
+ test ( "ignoreDirectories works without leading slash" , async ( ) => {
32
+ const results = await pluginCore . generateFilePaths ( {
33
+ fileAndDirPaths : [ "/" ] ,
34
+ ignoreDirectories : [ "admin" ] ,
35
+ PUBLISH_DIR ,
36
+ } ) ;
37
+ expect ( pathInResults ( "publishDir/blog/post1.html" , results ) ) . toBe ( true ) ;
38
+ expect ( pathInResults ( "publishDir/about.html" , results ) ) . toBe ( true ) ;
39
+ expect ( pathInResults ( "publishDir/index.html" , results ) ) . toBe ( true ) ;
40
+ expect ( pathInResults ( "publishDir/admin/index.html" , results ) ) . toBe ( false ) ;
41
+ } ) ;
0 commit comments