1
1
import { HashDiff } from "./HashDiff" ;
2
2
import { IFileList , currentSyncFileVersion , IFile } from "./types" ;
3
3
import { Record } from "./types" ;
4
- import { applyExcludeFilter , applyFolderFiltersToSubItems , getDefaultSettings , ILogger , Timings } from "./utilities" ;
4
+ import { applyExcludeFilter , getDefaultSettings , ILogger , Timings } from "./utilities" ;
5
5
import path from "path" ;
6
6
import FtpSrv from "ftp-srv" ;
7
7
import { getLocalFiles } from "./localFiles" ;
@@ -615,7 +615,7 @@ describe("getLocalFiles", () => {
615
615
new MockedStats ( "node_modules/@samkirkland/" ) ,
616
616
] ;
617
617
618
- const filteredStats = files . filter ( file => applyExcludeFilter ( file , applyFolderFiltersToSubItems ( excludeDefaults ) ) ) ;
618
+ const filteredStats = files . filter ( file => applyExcludeFilter ( file , excludeDefaults ) ) ;
619
619
620
620
expect ( filteredStats . map ( f => f . path ) ) . toStrictEqual ( [ "test/sam" ] ) ;
621
621
} ) ;
@@ -632,7 +632,7 @@ describe("getLocalFiles", () => {
632
632
new MockedStats ( "test/.git/workflows/main.yml" ) ,
633
633
] ;
634
634
635
- const filteredStats = files . filter ( file => applyExcludeFilter ( file , applyFolderFiltersToSubItems ( excludeDefaults ) ) ) ;
635
+ const filteredStats = files . filter ( file => applyExcludeFilter ( file , excludeDefaults ) ) ;
636
636
637
637
expect ( filteredStats . map ( f => f . path ) ) . toStrictEqual ( [ "test/sam" ] ) ;
638
638
} ) ;
@@ -652,7 +652,7 @@ describe("getLocalFiles", () => {
652
652
new MockedStats ( "node_modules/@samkirkland/" ) ,
653
653
] ;
654
654
655
- const filteredStats = files . filter ( file => applyExcludeFilter ( file , applyFolderFiltersToSubItems ( [ ] ) ) ) ;
655
+ const filteredStats = files . filter ( file => applyExcludeFilter ( file , [ ] ) ) ;
656
656
657
657
expect ( filteredStats . length ) . toBe ( 11 ) ;
658
658
} ) ;
@@ -663,7 +663,7 @@ describe("getLocalFiles", () => {
663
663
new MockedStats ( "test/folder/" ) ,
664
664
] ;
665
665
666
- const filteredStats = files . filter ( file => applyExcludeFilter ( file , applyFolderFiltersToSubItems ( [ "*.js" ] ) ) ) ;
666
+ const filteredStats = files . filter ( file => applyExcludeFilter ( file , [ "*.js" ] ) ) ;
667
667
668
668
expect ( filteredStats . map ( f => f . path ) ) . toStrictEqual ( [ "test/folder/" ] ) ;
669
669
} ) ;
@@ -674,7 +674,7 @@ describe("getLocalFiles", () => {
674
674
new MockedStats ( "test/folder/" ) ,
675
675
] ;
676
676
677
- const filteredStats = files . filter ( file => applyExcludeFilter ( file , applyFolderFiltersToSubItems ( [ "**/folder/**" ] ) ) ) ;
677
+ const filteredStats = files . filter ( file => applyExcludeFilter ( file , [ "**/folder/**" ] ) ) ;
678
678
679
679
expect ( filteredStats . map ( f => f . path ) ) . toStrictEqual ( [ "test/test.js" ] ) ;
680
680
} ) ;
@@ -685,7 +685,7 @@ describe("getLocalFiles", () => {
685
685
new MockedStats ( "test/folder/" ) ,
686
686
] ;
687
687
688
- const filteredStats = files . filter ( file => applyExcludeFilter ( file , applyFolderFiltersToSubItems ( [ "**/folder/**" ] ) ) ) ;
688
+ const filteredStats = files . filter ( file => applyExcludeFilter ( file , [ "**/folder/**" ] ) ) ;
689
689
690
690
expect ( filteredStats . map ( f => f . path ) ) . toStrictEqual ( [ "test/test.js" ] ) ;
691
691
} ) ;
@@ -697,21 +697,7 @@ describe("getLocalFiles", () => {
697
697
new MockedStats ( "test/folder/newfile.js" ) ,
698
698
] ;
699
699
700
- const filteredStats = files . filter ( file => applyExcludeFilter ( file , applyFolderFiltersToSubItems ( [ "test/folder/**" ] ) ) ) ;
701
-
702
- expect ( filteredStats . map ( f => f . path ) ) . toStrictEqual ( [ "test/test.js" ] ) ;
703
- } ) ;
704
-
705
- test ( "exclude existing folder while adding new file" , async ( ) => {
706
- const files : MockedStats [ ] = [
707
- new MockedStats ( "test/test.js" ) ,
708
- new MockedStats ( "test/folder/" ) ,
709
- new MockedStats ( "test/folder/subFolder/" ) ,
710
- new MockedStats ( "test/folder/newfile.js" ) ,
711
- new MockedStats ( "test/folder/sub/sub/sub/sub/newfile.js" ) ,
712
- ] ;
713
-
714
- const filteredStats = files . filter ( file => applyExcludeFilter ( file , applyFolderFiltersToSubItems ( [ "test/folder/" ] ) ) ) ;
700
+ const filteredStats = files . filter ( file => applyExcludeFilter ( file , [ "test/folder/**" ] ) ) ;
715
701
716
702
expect ( filteredStats . map ( f => f . path ) ) . toStrictEqual ( [ "test/test.js" ] ) ;
717
703
} ) ;
0 commit comments