@@ -14,19 +14,46 @@ import {
1414
1515describe ( 'bin module - function utilities' , ( ) => {
1616 describe ( 'isShadowBinPath' , ( ) => {
17- it ( 'should identify shadow bin paths' , ( ) => {
18- const result = isShadowBinPath ( '/some/path/.bin' )
19- expect ( typeof result ) . toBe ( 'boolean' )
17+ it ( 'should identify shadow bin paths with forward slashes' , ( ) => {
18+ const result = isShadowBinPath ( '/project/node_modules/.bin' )
19+ expect ( result ) . toBe ( true )
20+ } )
21+
22+ it ( 'should identify shadow bin paths with backslashes' , ( ) => {
23+ const result = isShadowBinPath ( 'C:\\project\\node_modules\\.bin' )
24+ expect ( result ) . toBe ( true )
25+ } )
26+
27+ it ( 'should identify nested shadow bin paths' , ( ) => {
28+ const result = isShadowBinPath (
29+ '/home/user/project/node_modules/.bin/subdir' ,
30+ )
31+ expect ( result ) . toBe ( true )
2032 } )
2133
2234 it ( 'should handle undefined path' , ( ) => {
2335 const result = isShadowBinPath ( undefined )
2436 expect ( result ) . toBe ( false )
2537 } )
2638
27- it ( 'should handle regular paths' , ( ) => {
39+ it ( 'should return false for empty string' , ( ) => {
40+ const result = isShadowBinPath ( '' )
41+ expect ( result ) . toBe ( false )
42+ } )
43+
44+ it ( 'should return false for regular paths' , ( ) => {
2845 const result = isShadowBinPath ( '/usr/local/bin' )
29- expect ( typeof result ) . toBe ( 'boolean' )
46+ expect ( result ) . toBe ( false )
47+ } )
48+
49+ it ( 'should return false for paths with .bin but not in node_modules' , ( ) => {
50+ const result = isShadowBinPath ( '/home/user/.bin' )
51+ expect ( result ) . toBe ( false )
52+ } )
53+
54+ it ( 'should return false for paths with node_modules but not .bin' , ( ) => {
55+ const result = isShadowBinPath ( '/home/user/node_modules/package' )
56+ expect ( result ) . toBe ( false )
3057 } )
3158 } )
3259
0 commit comments