Files
skill-repo/tests/README.md
T
Henner M. Kruse 2d25e69632 Add bats test suite for git-manager and obsidian-vault-kb
Isolated per-test $HOME sandboxing via tests/helpers/common.bash.
Covers both plugins' wrapper scripts, their setup.sh, and
git-manager's two PreToolUse hooks (53 tests). Verified the suite
catches regressions by temporarily reintroducing the recently-fixed
vault_search.sh -g/-- ordering bug and confirming it fails.
2026-08-04 19:34:51 +00:00

40 lines
1.3 KiB
Markdown

# Tests
A [bats-core](https://bats-core.readthedocs.io/) suite covering both
plugins' wrapper scripts, their `setup.sh`, and git-manager's two
`PreToolUse` hooks. Plain bats assertions only (`run` + `[ ]`/`[[ ]]`) — no
extra helper libraries.
## Install
```bash
sudo apt install bats
```
## Run
```bash
bats -r tests/ # everything (-r: recurse into subdirs)
bats -r tests/git-manager/ # one plugin
bats tests/obsidian-vault-kb/vault_search.bats # one file
```
## How it's isolated
Every test points `$HOME` at a fresh, bats-managed `$BATS_TEST_TMPDIR/home`
(see `tests/helpers/common.bash`, `sandbox_home`) before running any script
under test. Since every script here resolves its config from
`~/.agent-skills/<name>/config.json` and setup.sh writes to
`~/.claude/settings.json`, this means:
- Tests never read or write your real `~/.agent-skills/` or
`~/.claude/settings.json`.
- Nothing needs manual cleanup — bats deletes `$BATS_TEST_TMPDIR` after
each test automatically.
- Tests that exercise a `setup.sh` run the real script end to end (it's
what deploys the stable script copies + writes permissions/config), not a
mocked version.
There's no CI wiring for this suite yet — run it manually before/after
touching anything under `skills/` or `vendor/claude-code/plugins/`.