@@ -33,44 +33,44 @@ describe("LLMFileAccessController", () => {
3333
3434 describe ( "Default Patterns" , ( ) => {
3535 // it("should block access to common ignored files", async () => {
36- // const results = await Promise.all( [
36+ // const results = [
3737 // controller.validateAccess(".env"),
3838 // controller.validateAccess(".git/config"),
3939 // controller.validateAccess("node_modules/package.json"),
40- // ])
40+ // ]
4141 // results.forEach((result) => result.should.be.false())
4242 // })
4343
4444 it ( "should allow access to regular files" , async ( ) => {
45- const results = await Promise . all ( [
45+ const results = [
4646 controller . validateAccess ( "src/index.ts" ) ,
4747 controller . validateAccess ( "README.md" ) ,
4848 controller . validateAccess ( "package.json" ) ,
49- ] )
49+ ]
5050 results . forEach ( ( result ) => result . should . be . true ( ) )
5151 } )
5252 } )
5353
5454 describe ( "Custom Patterns" , ( ) => {
5555 it ( "should block access to custom ignored patterns" , async ( ) => {
56- const results = await Promise . all ( [
56+ const results = [
5757 controller . validateAccess ( "config.secret" ) ,
5858 controller . validateAccess ( "private/data.txt" ) ,
5959 controller . validateAccess ( "temp.json" ) ,
6060 controller . validateAccess ( "nested/deep/file.secret" ) ,
6161 controller . validateAccess ( "private/nested/deep/file.txt" ) ,
62- ] )
62+ ]
6363 results . forEach ( ( result ) => result . should . be . false ( ) )
6464 } )
6565
6666 it ( "should allow access to non-ignored files" , async ( ) => {
67- const results = await Promise . all ( [
67+ const results = [
6868 controller . validateAccess ( "public/data.txt" ) ,
6969 controller . validateAccess ( "config.json" ) ,
7070 controller . validateAccess ( "src/temp/file.ts" ) ,
7171 controller . validateAccess ( "nested/deep/file.txt" ) ,
7272 controller . validateAccess ( "not-private/data.txt" ) ,
73- ] )
73+ ]
7474 results . forEach ( ( result ) => result . should . be . true ( ) )
7575 } )
7676
@@ -83,11 +83,11 @@ describe("LLMFileAccessController", () => {
8383 controller = new LLMFileAccessController ( tempDir )
8484 await controller . initialize ( )
8585
86- const results = await Promise . all ( [
86+ const results = [
8787 controller . validateAccess ( "data-123.json" ) , // Should be false (wildcard)
8888 controller . validateAccess ( "data.json" ) , // Should be true (doesn't match pattern)
8989 controller . validateAccess ( "script.tmp" ) , // Should be false (extension match)
90- ] )
90+ ]
9191
9292 results [ 0 ] . should . be . false ( ) // data-123.json
9393 results [ 1 ] . should . be . true ( ) // data.json
@@ -112,9 +112,8 @@ describe("LLMFileAccessController", () => {
112112 // )
113113
114114 // controller = new LLMFileAccessController(tempDir)
115- // await controller.initialize()
116115
117- // const results = await Promise.all( [
116+ // const results = [
118117 // // Basic negation
119118 // controller.validateAccess("temp/file.txt"), // Should be false (in temp/)
120119 // controller.validateAccess("temp/allowed/file.txt"), // Should be true (negated)
@@ -130,7 +129,7 @@ describe("LLMFileAccessController", () => {
130129 // controller.validateAccess("assets/logo.png"), // Should be false (in assets/)
131130 // controller.validateAccess("assets/public/logo.png"), // Should be true (negated and matches *.png)
132131 // controller.validateAccess("assets/public/data.json"), // Should be true (in negated public/)
133- // ])
132+ // ]
134133
135134 // results[0].should.be.false() // temp/file.txt
136135 // results[1].should.be.true() // temp/allowed/file.txt
@@ -154,7 +153,7 @@ describe("LLMFileAccessController", () => {
154153 controller = new LLMFileAccessController ( tempDir )
155154 await controller . initialize ( )
156155
157- const result = await controller . validateAccess ( "test.secret" )
156+ const result = controller . validateAccess ( "test.secret" )
158157 result . should . be . false ( )
159158 } )
160159 } )
@@ -163,55 +162,55 @@ describe("LLMFileAccessController", () => {
163162 it ( "should handle absolute paths and match ignore patterns" , async ( ) => {
164163 // Test absolute path that should be allowed
165164 const allowedPath = path . join ( tempDir , "src/file.ts" )
166- const allowedResult = await controller . validateAccess ( allowedPath )
165+ const allowedResult = controller . validateAccess ( allowedPath )
167166 allowedResult . should . be . true ( )
168167
169168 // Test absolute path that matches an ignore pattern (*.secret)
170169 const ignoredPath = path . join ( tempDir , "config.secret" )
171- const ignoredResult = await controller . validateAccess ( ignoredPath )
170+ const ignoredResult = controller . validateAccess ( ignoredPath )
172171 ignoredResult . should . be . false ( )
173172
174173 // Test absolute path in ignored directory (private/)
175174 const ignoredDirPath = path . join ( tempDir , "private/data.txt" )
176- const ignoredDirResult = await controller . validateAccess ( ignoredDirPath )
175+ const ignoredDirResult = controller . validateAccess ( ignoredDirPath )
177176 ignoredDirResult . should . be . false ( )
178177 } )
179178
180179 it ( "should handle relative paths and match ignore patterns" , async ( ) => {
181180 // Test relative path that should be allowed
182- const allowedResult = await controller . validateAccess ( "./src/file.ts" )
181+ const allowedResult = controller . validateAccess ( "./src/file.ts" )
183182 allowedResult . should . be . true ( )
184183
185184 // Test relative path that matches an ignore pattern (*.secret)
186- const ignoredResult = await controller . validateAccess ( "./config.secret" )
185+ const ignoredResult = controller . validateAccess ( "./config.secret" )
187186 ignoredResult . should . be . false ( )
188187
189188 // Test relative path in ignored directory (private/)
190- const ignoredDirResult = await controller . validateAccess ( "./private/data.txt" )
189+ const ignoredDirResult = controller . validateAccess ( "./private/data.txt" )
191190 ignoredDirResult . should . be . false ( )
192191 } )
193192
194193 it ( "should normalize paths with backslashes" , async ( ) => {
195- const result = await controller . validateAccess ( "src\\file.ts" )
194+ const result = controller . validateAccess ( "src\\file.ts" )
196195 result . should . be . true ( )
197196 } )
198197
199198 it ( "should handle paths outside cwd" , async ( ) => {
200199 // Create a path that points to parent directory of cwd
201200 const outsidePath = path . join ( path . dirname ( tempDir ) , "outside.txt" )
202- const result = await controller . validateAccess ( outsidePath )
201+ const result = controller . validateAccess ( outsidePath )
203202
204203 // Should return false for security since path is outside cwd
205204 result . should . be . false ( )
206205
207206 // Test with a deeply nested path outside cwd
208207 const deepOutsidePath = path . join ( path . dirname ( tempDir ) , "deep" , "nested" , "outside.secret" )
209- const deepResult = await controller . validateAccess ( deepOutsidePath )
208+ const deepResult = controller . validateAccess ( deepOutsidePath )
210209 deepResult . should . be . false ( )
211210
212211 // Test with a path that tries to escape using ../
213212 const escapeAttemptPath = path . join ( tempDir , ".." , "escape-attempt.txt" )
214- const escapeResult = await controller . validateAccess ( escapeAttemptPath )
213+ const escapeResult = controller . validateAccess ( escapeAttemptPath )
215214 escapeResult . should . be . false ( )
216215 } )
217216 } )
@@ -228,7 +227,7 @@ describe("LLMFileAccessController", () => {
228227 describe ( "Error Handling" , ( ) => {
229228 it ( "should handle invalid paths" , async ( ) => {
230229 // Test with an invalid path containing null byte
231- const result = await controller . validateAccess ( "\0invalid" )
230+ const result = controller . validateAccess ( "\0invalid" )
232231 result . should . be . true ( )
233232 } )
234233
@@ -240,7 +239,7 @@ describe("LLMFileAccessController", () => {
240239 try {
241240 const controller = new LLMFileAccessController ( emptyDir )
242241 await controller . initialize ( )
243- const result = await controller . validateAccess ( "file.txt" )
242+ const result = controller . validateAccess ( "file.txt" )
244243 result . should . be . true ( )
245244 } finally {
246245 await fs . rm ( emptyDir , { recursive : true , force : true } )
@@ -253,7 +252,7 @@ describe("LLMFileAccessController", () => {
253252 controller = new LLMFileAccessController ( tempDir )
254253 await controller . initialize ( )
255254
256- const result = await controller . validateAccess ( "regular-file.txt" )
255+ const result = controller . validateAccess ( "regular-file.txt" )
257256 result . should . be . true ( )
258257 } )
259258 } )
0 commit comments