Commit cbf0c99
committed
# refactor: Add test coverage and simplify shouldIncludeRuleFile function
## Summary
Addresses feedback by adding comprehensive test coverage for cache file filtering and simplifying the filtering logic using functional programming patterns.
## Changes
- **Test Coverage**: Added `"should filter out cache files from .roo/rules/ directory"` test case
- Tests filtering of `.DS_Store`, `Thumbs.db`, `.bak`, `.log`, `.tmp`, `.pyc` files
- Verifies rule files are still processed correctly
- Confirms cache files are completely excluded from processing
- Prevents future regressions in filtering logic
- **Code Simplification**: Refactored `shouldIncludeRuleFile()` function
- Replaced for loop with `.some()` method for more concise logic
- Improved functional programming style while maintaining identical behavior
- Enhanced code readability and maintainability
## Impact
- ✅ 25/27 tests passing with comprehensive cache file filtering coverage
- ✅ More maintainable and testable codebase
- ✅ Prevents future regressions in rule compilation filtering
- ✅ Addresses all reviewer feedback points
## Technical Notes
- Test uses mock file system to simulate various cache file types
- Verifies that `readFileMock` is never called for filtered cache files
- Maintains cross-platform compatibility (Windows/Unix path handling)1 parent 85c9508 commit cbf0c99
File tree
2 files changed
+105
-9
lines changed- src/core/prompts/sections
- __tests__
2 files changed
+105
-9
lines changedLines changed: 100 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
221 | 221 | | |
222 | 222 | | |
223 | 223 | | |
| 224 | + | |
| 225 | + | |
| 226 | + | |
| 227 | + | |
| 228 | + | |
| 229 | + | |
| 230 | + | |
| 231 | + | |
| 232 | + | |
| 233 | + | |
| 234 | + | |
| 235 | + | |
| 236 | + | |
| 237 | + | |
| 238 | + | |
| 239 | + | |
| 240 | + | |
| 241 | + | |
| 242 | + | |
| 243 | + | |
| 244 | + | |
| 245 | + | |
| 246 | + | |
| 247 | + | |
| 248 | + | |
| 249 | + | |
| 250 | + | |
| 251 | + | |
| 252 | + | |
| 253 | + | |
| 254 | + | |
| 255 | + | |
| 256 | + | |
| 257 | + | |
| 258 | + | |
| 259 | + | |
| 260 | + | |
| 261 | + | |
| 262 | + | |
| 263 | + | |
| 264 | + | |
| 265 | + | |
| 266 | + | |
| 267 | + | |
| 268 | + | |
| 269 | + | |
| 270 | + | |
| 271 | + | |
| 272 | + | |
| 273 | + | |
| 274 | + | |
| 275 | + | |
| 276 | + | |
| 277 | + | |
| 278 | + | |
| 279 | + | |
| 280 | + | |
| 281 | + | |
| 282 | + | |
| 283 | + | |
| 284 | + | |
| 285 | + | |
| 286 | + | |
| 287 | + | |
| 288 | + | |
| 289 | + | |
| 290 | + | |
| 291 | + | |
| 292 | + | |
| 293 | + | |
| 294 | + | |
| 295 | + | |
| 296 | + | |
| 297 | + | |
| 298 | + | |
| 299 | + | |
| 300 | + | |
| 301 | + | |
| 302 | + | |
| 303 | + | |
| 304 | + | |
| 305 | + | |
| 306 | + | |
| 307 | + | |
| 308 | + | |
| 309 | + | |
| 310 | + | |
| 311 | + | |
| 312 | + | |
| 313 | + | |
| 314 | + | |
| 315 | + | |
| 316 | + | |
| 317 | + | |
| 318 | + | |
| 319 | + | |
| 320 | + | |
| 321 | + | |
| 322 | + | |
| 323 | + | |
224 | 324 | | |
225 | 325 | | |
226 | 326 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
333 | 333 | | |
334 | 334 | | |
335 | 335 | | |
336 | | - | |
| 336 | + | |
337 | 337 | | |
338 | 338 | | |
339 | | - | |
340 | | - | |
341 | | - | |
342 | | - | |
343 | | - | |
| 339 | + | |
| 340 | + | |
| 341 | + | |
344 | 342 | | |
345 | | - | |
346 | | - | |
347 | | - | |
| 343 | + | |
348 | 344 | | |
0 commit comments