Files
claude-code/src/utils/__tests__
JiayuWang(王嘉宇) fdb2442ad4 test: add coverage for toRelativePath and getDirectoryForPath (#95)
These two exported functions in src/utils/path.ts lacked unit tests.

toRelativePath wraps Node's path.relative() and keeps the absolute
path when the result would start with '..' (i.e. the target is outside
the CWD). Four tests cover: child-of-cwd, outside-cwd, cwd-itself,
and the type-safety invariant.

getDirectoryForPath uses statSync to distinguish directories from files,
falling back to dirname() for non-existent paths and bypassing the
filesystem for UNC paths (NTLM credential-leak prevention). Three tests
cover: existing directory, known file, and non-existent path.

Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-03 23:36:19 +08:00
..
2026-04-02 14:44:56 +08:00
2026-04-02 16:03:20 +08:00
2026-04-02 14:44:56 +08:00
2026-04-02 16:03:20 +08:00
2026-04-02 14:44:56 +08:00
2026-04-02 14:44:56 +08:00
2026-04-02 16:03:20 +08:00
2026-04-02 16:03:20 +08:00
2026-04-02 16:03:20 +08:00
2026-04-02 14:44:56 +08:00
2026-04-02 16:03:20 +08:00
2026-04-02 20:28:08 +08:00