From 9a81bb2d6fb4450cfa059fcebc39adfed7d0fc43 Mon Sep 17 00:00:00 2001 From: Matteo Cherubini Date: Fri, 5 Jun 2026 09:59:18 +0200 Subject: [PATCH] test(ingest): Add tests for slug validation and index-append updates --- tests/scripts.bats | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/tests/scripts.bats b/tests/scripts.bats index 5b7fe1b..86d18cd 100644 --- a/tests/scripts.bats +++ b/tests/scripts.bats @@ -51,3 +51,18 @@ load helpers python3 "$SKILL_SCRIPTS/index-append.py" --section Sources --entry '- [[sources/dup]] — d. `maturity: draft`' [ "$(grep -c 'sources/dup' wiki/index.md)" -eq 1 ] } + +@test "index-append: updates an existing entry by wikilink path (no duplicate)" { + G="$(make_fixture_genome)"; cd "$G" + python3 "$SKILL_SCRIPTS/index-append.py" --section Sources --entry '- [[sources/foo]] — old summary. `maturity: draft`' + python3 "$SKILL_SCRIPTS/index-append.py" --section Sources --entry '- [[sources/foo]] — new summary. `maturity: stable`' + [ "$(grep -c 'sources/foo' wiki/index.md)" -eq 1 ] + grep -q 'new summary' wiki/index.md + ! grep -q 'old summary' wiki/index.md +} + +@test "slug: refuses an all-symbols input (no empty slug)" { + run bash "$SKILL_SCRIPTS/slug.sh" "!!!.md" + [ "$status" -ne 0 ] + [ -z "$output" ] || [[ "$output" != *"feat/ai-ingest-"* ]] +}