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 16:03:20 +08:00
2026-04-02 14:44:56 +08:00
2026-04-01 02:08:38 +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 20:28:08 +08:00
2026-04-02 20:28:08 +08:00
2026-04-02 20:28:08 +08:00
2026-04-02 14:44:56 +08:00
2026-04-02 10:11:43 +08:00
2026-04-01 22:23:26 +08:00
2026-04-02 20:28:08 +08:00
2026-04-02 14:44:56 +08:00
2026-04-02 20:28:08 +08:00
2026-04-02 10:11:43 +08:00
2026-04-02 10:11:43 +08:00
2026-04-02 09:29:01 +08:00
2026-04-02 16:03:20 +08:00
2026-04-02 08:50:29 +08:00
2026-04-02 14:44:56 +08:00
2026-04-02 20:28:08 +08:00
2026-04-03 22:17:58 +08:00
2026-04-02 10:11:43 +08:00
2026-04-01 22:03:02 +08:00
2026-04-02 20:28:08 +08:00
2026-04-01 22:30:45 +08:00
2026-04-02 16:03:20 +08:00
2026-04-01 22:03:02 +08:00
2026-04-02 09:29:01 +08:00
2026-04-02 14:44:56 +08:00
2026-04-02 20:28:08 +08:00
2026-04-02 10:11:43 +08:00
2026-04-01 23:56:37 +08:00
2026-04-02 20:28:08 +08:00
2026-04-02 20:28:08 +08:00
2026-04-02 09:29:01 +08:00
2026-04-02 14:44:56 +08:00
2026-04-02 20:28:08 +08:00
2026-04-02 14:44:56 +08:00
2026-04-02 14:44:56 +08:00
2026-04-03 23:36:19 +08:00
2026-04-02 20:28:08 +08:00
2026-04-02 08:50:29 +08:00
2026-04-02 20:28:08 +08:00
2026-04-02 20:28:08 +08:00
2026-04-02 14:44:56 +08:00
2026-04-02 20:28:08 +08:00
2026-04-01 02:08:38 +08:00
2026-04-02 08:50:29 +08:00
2026-04-02 09:29:01 +08:00
2026-04-02 16:03:20 +08:00
2026-04-02 16:03:20 +08:00
2026-04-01 22:03:02 +08:00
2026-04-01 22:14:23 +08:00
2026-04-02 10:11:43 +08:00
2026-04-02 20:28:08 +08:00
2026-04-02 10:11:43 +08:00
2026-04-01 23:56:37 +08:00
2026-04-02 16:03:20 +08:00
2026-04-02 14:44:56 +08:00
2026-04-02 20:28:08 +08:00
2026-04-02 14:44:56 +08:00
2026-04-02 10:11:43 +08:00
2026-04-02 20:28:08 +08:00
2026-04-02 16:03:20 +08:00
2026-04-02 20:28:08 +08:00
2026-04-01 22:03:02 +08:00
2026-04-02 14:44:56 +08:00