@@ -167,28 +167,33 @@ describe('File Service', () => {
167167
168168 test ( 'safe relative path' , ( ) => {
169169 mockCwd ( '/safe/path' ) ;
170- expect ( fileService . isDangerous ( '../project/node_modules' ) ) . toBe ( false ) ;
170+ expect (
171+ fileService . isDangerous ( '../project/node_modules' ) . isSensitive ,
172+ ) . toBe ( false ) ;
171173 } ) ;
172174
173175 test ( 'hidden relative path' , ( ) => {
174176 mockCwd ( '/home/user/projects' ) ;
175- expect ( fileService . isDangerous ( '../.config/secret' ) ) . toBe ( true ) ;
177+ expect ( fileService . isDangerous ( '../.config/secret' ) . isSensitive ) . toBe (
178+ true ,
179+ ) ;
176180 } ) ;
177181
178182 test ( 'node_modules in ~/.cache' , ( ) => {
179183 expect (
180- fileService . isDangerous ( '/home/user/.cache/project/node_modules' ) ,
184+ fileService . isDangerous ( '/home/user/.cache/project/node_modules' )
185+ . isSensitive ,
181186 ) . toBe ( false ) ;
182187 } ) ;
183188
184189 test ( 'parent relative path (..)' , ( ) => {
185190 mockCwd ( '/home/user' ) ;
186- expect ( fileService . isDangerous ( '..' ) ) . toBe ( false ) ;
191+ expect ( fileService . isDangerous ( '..' ) . isSensitive ) . toBe ( false ) ;
187192 } ) ;
188193
189194 test ( 'current relative path (.)' , ( ) => {
190195 mockCwd ( '/home/user' ) ;
191- expect ( fileService . isDangerous ( '.' ) ) . toBe ( false ) ;
196+ expect ( fileService . isDangerous ( '.' ) . isSensitive ) . toBe ( false ) ;
192197 } ) ;
193198 } ) ;
194199
@@ -200,25 +205,29 @@ describe('File Service', () => {
200205
201206 test ( 'safe relative path' , ( ) => {
202207 mockCwd ( 'D:\\safe\\path' ) ;
203- expect ( fileService . isDangerous ( '..\\project\\node_modules' ) ) . toBe (
204- false ,
205- ) ;
208+ expect (
209+ fileService . isDangerous ( '..\\project\\node_modules' ) . isSensitive ,
210+ ) . toBe ( false ) ;
206211 } ) ;
207212
208213 test ( 'AppData relative path' , ( ) => {
209214 mockCwd ( 'C:\\Users\\user\\Documents' ) ;
210- expect ( fileService . isDangerous ( '..\\AppData\\Roaming\\app' ) ) . toBe ( true ) ;
215+ expect (
216+ fileService . isDangerous ( '..\\AppData\\Roaming\\app' ) . isSensitive ,
217+ ) . toBe ( true ) ;
211218 } ) ;
212219
213220 test ( 'Program Files (x86)' , ( ) => {
214221 expect (
215- fileService . isDangerous ( 'C:\\Program Files (x86)\\app\\node_modules' ) ,
222+ fileService . isDangerous ( 'C:\\Program Files (x86)\\app\\node_modules' )
223+ . isSensitive ,
216224 ) . toBe ( true ) ;
217225 } ) ;
218226
219227 test ( 'network paths' , ( ) => {
220228 expect (
221- fileService . isDangerous ( '\\\\network\\share\\.hidden\\node_modules' ) ,
229+ fileService . isDangerous ( '\\\\network\\share\\.hidden\\node_modules' )
230+ . isSensitive ,
222231 ) . toBe ( true ) ;
223232 } ) ;
224233 } ) ;
@@ -227,31 +236,33 @@ describe('File Service', () => {
227236 test ( 'no home directory' , ( ) => {
228237 delete process . env . HOME ;
229238 delete process . env . USERPROFILE ;
230- expect ( fileService . isDangerous ( '/some/path' ) ) . toBe ( false ) ;
239+ expect ( fileService . isDangerous ( '/some/path' ) . isSensitive ) . toBe ( false ) ;
231240 } ) ;
232241
233242 test ( 'whitelisted hidden segments' , ( ) => {
234243 expect (
235- fileService . isDangerous ( '/tmp/.cache/project/node_modules' ) ,
244+ fileService . isDangerous ( '/tmp/.cache/project/node_modules' )
245+ . isSensitive ,
246+ ) . toBe ( false ) ;
247+ expect (
248+ fileService . isDangerous ( '/tmp/.npm/project/node_modules' ) . isSensitive ,
236249 ) . toBe ( false ) ;
237- expect ( fileService . isDangerous ( '/tmp/.npm/project/node_modules' ) ) . toBe (
238- false ,
239- ) ;
240250 } ) ;
241251
242252 test ( 'macOS application bundle' , ( ) => {
243253 expect (
244254 fileService . isDangerous (
245255 '/Applications/MyApp.app/Contents/node_modules' ,
246- ) ,
256+ ) . isSensitive ,
247257 ) . toBe ( true ) ;
248258 } ) ;
249259
250260 test ( 'Windows-style path on POSIX' , ( ) => {
251261 process . env . HOME = '/home/user' ;
252- expect ( fileService . isDangerous ( '/home/user/AppData/Local/.cache' ) ) . toBe (
253- false ,
254- ) ;
262+ expect (
263+ fileService . isDangerous ( '/home/user/AppData/Local/.cache' )
264+ . isSensitive ,
265+ ) . toBe ( false ) ;
255266 } ) ;
256267 } ) ;
257268 } ) ;
0 commit comments