|
321 | 321 | :path b-file |
322 | 322 | :content b-content}]) |
323 | 323 | (#'f.context/parse-agents-file a-file))))))) |
324 | | - (testing "Missing referenced file is ignored" |
325 | | - (let [a-file (h/file-path "/fake/AGENTS.md") |
326 | | - a-content (multi-str |
327 | | - "- do foo" |
328 | | - "- check @missing.md for missing things") |
329 | | - missing-file (h/file-path "/fake/missing.md")] |
330 | | - (with-redefs [llm-api/refine-file-context (fn [p _l] |
331 | | - (condp = p |
332 | | - a-file a-content |
333 | | - missing-file nil))] |
334 | | - (is (match? |
335 | | - (m/in-any-order |
336 | | - [{:type :agents-file |
337 | | - :path a-file |
338 | | - :content a-content}]) |
339 | | - (#'f.context/parse-agents-file a-file)))))) |
| 324 | +(testing "Missing referenced file is ignored" |
| 325 | + (let [a-file (h/file-path "/fake/AGENTS.md") |
| 326 | + a-content (multi-str |
| 327 | + "- do foo" |
| 328 | + "- check @missing.md for missing things") |
| 329 | + missing-file (h/file-path "/fake/missing.md")] |
| 330 | + (with-redefs [llm-api/refine-file-context (fn [p _l] |
| 331 | + (condp = p |
| 332 | + a-file a-content |
| 333 | + missing-file nil))] |
| 334 | + (is (match? |
| 335 | + (m/in-any-order |
| 336 | + [{:type :agents-file |
| 337 | + :path a-file |
| 338 | + :content a-content}]) |
| 339 | + (#'f.context/parse-agents-file a-file)))))) |
340 | 340 |
|
341 | 341 | (deftest contexts-str-from-prompt-test |
342 | 342 | (testing "not context mention" |
|
359 | 359 | :path "/path/to/file" |
360 | 360 | :lines-range {:start 1 :end 4} |
361 | 361 | :content "Some content"}] |
362 | | - (f.context/contexts-str-from-prompt "check @/path/to/file:L1-L4" (h/db))))))) |
| 362 | + (f.context/contexts-str-from-prompt "check @/path/to/file:L1-L4" (h/db)))))) |
| 363 | + (testing "directory" |
| 364 | + (with-redefs [fs/readable? (constantly true) |
| 365 | + fs/directory? (fn [path] |
| 366 | + (= "/path/to/folder" path)) |
| 367 | + fs/glob (constantly ["/path/to/folder/foo.txt" "/path/to/folder/bar.s"]) |
| 368 | + llm-api/refine-file-context (constantly "Some content")] |
| 369 | + (is (match? |
| 370 | + [{:type :file |
| 371 | + :path "/path/to/folder/foo.txt" |
| 372 | + :content "Some content"} |
| 373 | + {:type :file |
| 374 | + :path "/path/to/folder/bar.s" |
| 375 | + :content "Some content"}] |
| 376 | + (f.context/contexts-str-from-prompt "check @/path/to/folder" (h/db))))))) |
0 commit comments