From 06bd74d64f6e68d68cc239840120588d208b04c4 Mon Sep 17 00:00:00 2001 From: "Henner M. Kruse" Date: Wed, 5 Aug 2026 04:31:06 +0000 Subject: [PATCH] Close the 3 real remaining coverage gaps - vault_index.sh: grep fallback for frontmatter tag extraction when rg is unavailable (had this for vault_search.sh/vault_backlinks.sh, not vault_index.sh). - git_cmd.bats: registered repo path that's a file, not a directory (had the obsidian equivalent, not git-manager's). - git_cmd.bats: missing python3 in resolve_repo_path (previously only tested via setup.sh/vault_index.sh, not git_cmd.sh's own _lib.sh). 76 tests now (was 73). kcov: 87.84% (260/296 lines), up from 86.15% -- both target files (vault_index.sh, git-manager _lib.sh) now at 100%. Remaining gap is entirely kcov's inability to trace multi-line python3/awk/jq blocks and bash 'case pattern) ;;' no-op branches, confirmed by checking hit counts on the surrounding lines -- not further closeable by adding tests. --- tests/git-manager/git_cmd.bats | 17 +++++++++++++++++ tests/obsidian-vault-kb/vault_index.bats | 9 +++++++++ 2 files changed, 26 insertions(+) diff --git a/tests/git-manager/git_cmd.bats b/tests/git-manager/git_cmd.bats index 71cf848..ccf5ce1 100644 --- a/tests/git-manager/git_cmd.bats +++ b/tests/git-manager/git_cmd.bats @@ -109,6 +109,23 @@ setup() { [[ "$output" == *"== Repo: $REPO =="* ]] } +@test "a registered path that is a file, not a directory, errors" { + FILE_PATH="$BATS_TEST_TMPDIR/not-a-dir" + echo "just a file" > "$FILE_PATH" + write_git_manager_config "$CONFIG_FILE" "plain=$FILE_PATH" + run "$SCRIPT" status --repo plain + [ "$status" -eq 1 ] + [[ "$output" == *"is not a directory"* ]] +} + +@test "missing python3 fails with a clear error instead of a silent crash" { + write_git_manager_config "$CONFIG_FILE" "myrepo=$REPO" + hide_command python3 + run "$SCRIPT" status --repo myrepo + [ "$status" -eq 1 ] + [[ "$output" == *"python3 is required"* ]] +} + # --- -- passthrough --- @test "args after -- reach git unmodified" { diff --git a/tests/obsidian-vault-kb/vault_index.bats b/tests/obsidian-vault-kb/vault_index.bats index 5bb5ad4..1920e13 100644 --- a/tests/obsidian-vault-kb/vault_index.bats +++ b/tests/obsidian-vault-kb/vault_index.bats @@ -34,6 +34,15 @@ setup() { done } +@test "grep fallback still extracts tags when rg is unavailable" { + hide_command rg + run "$SCRIPT" v + [ "$status" -eq 0 ] + for tag in dns homelab networking overview; do + [[ "$output" == *"$tag"* ]] + done +} + @test "a note matching *overview* is flagged as a possible MOC file" { run "$SCRIPT" v [ "$status" -eq 0 ]