@@ -27,15 +27,19 @@ test("file explorer syncs the workspace root only when the selected workspace ch
2727 ) ;
2828 assert . match (
2929 source ,
30- / w i n d o w \. e l e c t r o n A P I \. f s \. l i s t D i r e c t o r y \( \s * t a r g e t P a t h \? \? n u l l , \s * s e l e c t e d W o r k s p a c e I d \? \? n u l l , \s * \) / ,
30+ / c o n s t v a l i d a t e W o r k s p a c e S c o p e d T a r g e t P a t h = u s e C a l l b a c k \( / ,
31+ ) ;
32+ assert . match (
33+ source ,
34+ / c o n s t \{ a l l o w e d , t a r g e t P a t h : v a l i d a t e d T a r g e t P a t h \} = \s * a w a i t v a l i d a t e W o r k s p a c e S c o p e d T a r g e t P a t h \( t a r g e t P a t h \? \? n u l l \) ; [ \s \S ] * w i n d o w \. e l e c t r o n A P I \. f s \. l i s t D i r e c t o r y \( \s * v a l i d a t e d T a r g e t P a t h , \s * s e l e c t e d W o r k s p a c e I d \? \? n u l l , \s * \) / ,
3135 ) ;
3236 assert . match (
3337 source ,
3438 / c o n s t w o r k s p a c e S e s s i o n K e y = w o r k s p a c e S e s s i o n K e y R e f \. c u r r e n t ; \s * c o n s t r e q u e s t K e y = \+ \+ d i r e c t o r y L o a d R e q u e s t K e y R e f \. c u r r e n t ; / ,
3539 ) ;
3640 assert . match (
3741 source ,
38- / i f \( \s * w o r k s p a c e S e s s i o n K e y ! = = w o r k s p a c e S e s s i o n K e y R e f \. c u r r e n t \| \| \s * r e q u e s t K e y ! = = d i r e c t o r y L o a d R e q u e s t K e y R e f \. c u r r e n t \s * \) \{ \s * r e t u r n ; \s * \} / ,
42+ / i f \( \s * w o r k s p a c e S e s s i o n K e y ! = = w o r k s p a c e S e s s i o n K e y R e f \. c u r r e n t \| \| \s * r e q u e s t K e y ! = = d i r e c t o r y L o a d R e q u e s t K e y R e f \. c u r r e n t \| \| \s * ! a l l o w e d \s * \) \{ \s * r e t u r n ; \s * \} / ,
3943 ) ;
4044 assert . match (
4145 source ,
@@ -57,15 +61,18 @@ test("file explorer refreshes the current directory and expanded folders to surf
5761 assert . match ( source , / r e f r e s h T a r g e t s \. m a p \( \( t a r g e t P a t h \) = > / ) ;
5862 assert . match (
5963 source ,
60- / w i n d o w \. e l e c t r o n A P I \. f s \. l i s t D i r e c t o r y \( \s * t a r g e t P a t h , \s * s e l e c t e d W o r k s p a c e I d \? \? n u l l , \s * \) / ,
64+ / c o n s t \{ a l l o w e d , t a r g e t P a t h : v a l i d a t e d T a r g e t P a t h \} = \s * a w a i t v a l i d a t e W o r k s p a c e S c o p e d T a r g e t P a t h \( t a r g e t P a t h \) ; [ \s \S ] * i f \( ! a l l o w e d \| \| ! v a l i d a t e d T a r g e t P a t h \) \{ \s * r e t u r n n u l l ; \s * \} [ \s \S ] * w i n d o w \. e l e c t r o n A P I \. f s \. l i s t D i r e c t o r y \( \s * v a l i d a t e d T a r g e t P a t h , \s * s e l e c t e d W o r k s p a c e I d \? \? n u l l , \s * \) / ,
6165 ) ;
6266 assert . match (
6367 source ,
6468 / s e t D i r e c t o r y E n t r i e s B y P a t h \( \( c u r r e n t \) = > \( \{ \s * \. \. \. c u r r e n t , \s * \. \. \. r e f r e s h e d E n t r i e s B y P a t h , \s * \} \) \) ; / ,
6569 ) ;
6670 assert . match ( source , / c o n s t t i m e r = w i n d o w \. s e t I n t e r v a l \( \( \) = > \{ \s * v o i d r e f r e s h L o a d e d D i r e c t o r i e s \( \) ; \s * \} , 1 2 0 0 \) ; / ) ;
6771 assert . match ( source , / w i n d o w \. c l e a r I n t e r v a l \( t i m e r \) ; / ) ;
68- assert . match ( source , / \} , \[ c u r r e n t P a t h , e x p a n d e d D i r e c t o r y P a t h s , s e l e c t e d W o r k s p a c e I d \] \) ; / ) ;
72+ assert . match (
73+ source ,
74+ / \} , \[ \s * c u r r e n t P a t h , \s * e x p a n d e d D i r e c t o r y P a t h s , \s * s e l e c t e d W o r k s p a c e I d , \s * v a l i d a t e W o r k s p a c e S c o p e d T a r g e t P a t h , \s * \] \) ; / ,
75+ ) ;
6976} ) ;
7077
7178test ( "file explorer live-refreshes inline previews from file watch events without overwriting dirty edits" , async ( ) => {
@@ -87,14 +94,17 @@ test("file explorer live-refreshes inline previews from file watch events withou
8794 source ,
8895 / w i n d o w \. e l e c t r o n A P I \. f s [ \s \S ] * \. w a t c h F i l e \( / ,
8996 ) ;
90- assert . match ( source , / w a t c h e d P a t h , \s * s e l e c t e d W o r k s p a c e I d \? \? n u l l / ) ;
9197 assert . match (
9298 source ,
9399 / i f \( \s * c a n c e l l e d \| \| \s * r e f r e s h I n F l i g h t \| \| \s * i s D i r t y R e f \. c u r r e n t \| \| \s * i s S a v i n g R e f \. c u r r e n t \s * \) \{ \s * r e t u r n ; \s * \} / ,
94100 ) ;
95101 assert . match (
96102 source ,
97- / c o n s t n e x t P r e v i e w = a w a i t w i n d o w \. e l e c t r o n A P I \. f s \. r e a d F i l e P r e v i e w \( \s * w a t c h e d P a t h , \s * s e l e c t e d W o r k s p a c e I d \? \? n u l l , \s * \) ; [ \s \S ] * s e t P r e v i e w \( n e x t P r e v i e w \) ; [ \s \S ] * s e t P r e v i e w D r a f t \( n e x t P r e v i e w \. c o n t e n t \? \? " " \) ; / ,
103+ / c o n s t \{ a l l o w e d , t a r g e t P a t h : v a l i d a t e d W a t c h e d P a t h \} = \s * a w a i t v a l i d a t e W o r k s p a c e S c o p e d T a r g e t P a t h \( w a t c h e d P a t h \) ; [ \s \S ] * i f \( ! a l l o w e d \| \| ! v a l i d a t e d W a t c h e d P a t h \) \{ \s * r e t u r n ; \s * \} [ \s \S ] * c o n s t n e x t P r e v i e w = a w a i t w i n d o w \. e l e c t r o n A P I \. f s \. r e a d F i l e P r e v i e w \( \s * v a l i d a t e d W a t c h e d P a t h , \s * s e l e c t e d W o r k s p a c e I d \? \? n u l l , \s * \) ; [ \s \S ] * s e t P r e v i e w \( n e x t P r e v i e w \) ; [ \s \S ] * s e t P r e v i e w D r a f t \( n e x t P r e v i e w \. c o n t e n t \? \? " " \) ; / ,
104+ ) ;
105+ assert . match (
106+ source ,
107+ / c o n s t \{ a l l o w e d , t a r g e t P a t h : v a l i d a t e d W a t c h e d P a t h \} = \s * a w a i t v a l i d a t e W o r k s p a c e S c o p e d T a r g e t P a t h \( w a t c h e d P a t h \) ; [ \s \S ] * i f \( ! a l l o w e d \| \| ! v a l i d a t e d W a t c h e d P a t h \) \{ \s * r e t u r n ; \s * \} [ \s \S ] * w i n d o w \. e l e c t r o n A P I \. f s \. w a t c h F i l e \( \s * v a l i d a t e d W a t c h e d P a t h , \s * s e l e c t e d W o r k s p a c e I d \? \? n u l l , \s * \) / ,
98108 ) ;
99109 assert . match ( source , / v o i d w i n d o w \. e l e c t r o n A P I \. f s \. u n w a t c h F i l e \( s u b s c r i p t i o n I d \) ; / ) ;
100110} ) ;
@@ -276,7 +286,7 @@ test("file explorer adds a markdown preview mode while keeping text editing inli
276286 assert . match ( source , / w i n d o w \. e l e c t r o n A P I \. u i \. o p e n E x t e r n a l U r l \( u r l \) / ) ;
277287 assert . match (
278288 source ,
279- / w i n d o w \. e l e c t r o n A P I \. f s \. r e a d F i l e P r e v i e w \( \s * t a r g e t P a t h , \s * s e l e c t e d W o r k s p a c e I d \? \? n u l l , \s * \) / ,
289+ / c o n s t \{ a l l o w e d , t a r g e t P a t h : v a l i d a t e d T a r g e t P a t h \} = \s * a w a i t v a l i d a t e W o r k s p a c e S c o p e d T a r g e t P a t h \( t a r g e t P a t h \) ; [ \s \S ] * w i n d o w \. e l e c t r o n A P I \. f s \. r e a d F i l e P r e v i e w \( \s * v a l i d a t e d T a r g e t P a t h , \s * s e l e c t e d W o r k s p a c e I d \? \? n u l l , \s * \) / ,
280290 ) ;
281291 assert . match (
282292 source ,
0 commit comments