test(app): 補齊 isSafeRepoPath/extractBalancedJSON/normalizeText/repairJSONArrayWithAI/格式化函式測試

為可測性 export 三個內部函式(isSafeRepoPath、extractBalancedJSON/extractJSONText、normalizeText)。

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
Jeffery
2026-06-26 14:41:41 +08:00
co-authored by Claude Opus 4.8
parent fc10ab7266
commit 775cc575ae
8 changed files with 354 additions and 5 deletions
+1 -1
View File
@@ -171,7 +171,7 @@ function toExclusion(botFinding) {
* @param {string} p - 待檢查的檔案路徑。
* @returns {boolean} 安全(repo 內相對路徑)為 true,否則 false。
*/
function isSafeRepoPath(p) {
export function isSafeRepoPath(p) {
if (typeof p !== 'string' || p === '') return false;
if (p.startsWith('/') || /^[a-zA-Z]:/.test(p)) return false;
return !p.split('/').includes('..');