|
| 1 | +--- |
| 2 | +id: dso-5l1c |
| 3 | +status: open |
| 4 | +deps: [] |
| 5 | +links: [] |
| 6 | +created: 2026-03-17T21:06:55Z |
| 7 | +type: task |
| 8 | +priority: 0 |
| 9 | +assignee: Joe Oakhart |
| 10 | +parent: dso-r9fa |
| 11 | +--- |
| 12 | +# Write failing tests for dso-setup command (RED) |
| 13 | + |
| 14 | +## TDD Requirement (RED phase) |
| 15 | + |
| 16 | +Create tests/scripts/test-dso-setup.sh with 5 failing tests. All FAIL because scripts/dso-setup.sh does not exist yet. |
| 17 | + |
| 18 | +## Implementation Steps |
| 19 | + |
| 20 | +1. Create tests/scripts/test-dso-setup.sh |
| 21 | +2. Source $PLUGIN_ROOT/tests/lib/assert.sh |
| 22 | +3. Define SETUP_SCRIPT=$(git rev-parse --show-toplevel)/scripts/dso-setup.sh |
| 23 | +4. Each test creates its own TMPDIR=$(mktemp -d) with trap 'rm -rf $TMPDIR' EXIT |
| 24 | + |
| 25 | +## Tests to write: |
| 26 | + |
| 27 | +**test_setup_creates_shim** |
| 28 | +- bash "$SETUP_SCRIPT" "$TMPDIR" "$PLUGIN_ROOT" |
| 29 | +- Assert: test -f "$TMPDIR/.claude/scripts/dso" |
| 30 | + |
| 31 | +**test_setup_shim_executable** |
| 32 | +- bash "$SETUP_SCRIPT" "$TMPDIR" "$PLUGIN_ROOT" |
| 33 | +- Assert: test -x "$TMPDIR/.claude/scripts/dso" |
| 34 | + |
| 35 | +**test_setup_writes_plugin_root** |
| 36 | +- bash "$SETUP_SCRIPT" "$TMPDIR" "$PLUGIN_ROOT" |
| 37 | +- Assert: grep -q '^dso.plugin_root=' "$TMPDIR/workflow-config.conf" (use absolute path to tmpdir file) |
| 38 | + |
| 39 | +**test_setup_is_idempotent** |
| 40 | +- Run setup twice on empty config; grep -c '^dso.plugin_root=' must equal 1 |
| 41 | +- Also: pre-populate config with existing entry, run once, assert count still 1 |
| 42 | + |
| 43 | +**test_setup_dso_tk_help_works** |
| 44 | +- bash "$SETUP_SCRIPT" "$TMPDIR" "$PLUGIN_ROOT" |
| 45 | +- Then: (cd "$TMPDIR" && unset CLAUDE_PLUGIN_ROOT && "./.claude/scripts/dso" tk --help) |
| 46 | +- Assert exit 0 |
| 47 | + |
| 48 | +5. chmod +x tests/scripts/test-dso-setup.sh |
| 49 | + |
| 50 | +## Acceptance Criteria |
| 51 | + |
| 52 | +- [ ] run-all.sh exits with failures (confirming RED) |
| 53 | + Verify: bash $(git rev-parse --show-toplevel)/tests/run-all.sh 2>&1 | grep -q 'FAILED: [^0]' |
| 54 | +- [ ] ruff check passes |
| 55 | + Verify: ruff check scripts/*.py tests/**/*.py |
| 56 | +- [ ] ruff format --check passes |
| 57 | + Verify: ruff format --check scripts/*.py tests/**/*.py |
| 58 | +- [ ] test-dso-setup.sh exists and is executable |
| 59 | + Verify: test -x $(git rev-parse --show-toplevel)/tests/scripts/test-dso-setup.sh |
| 60 | +- [ ] Contains at least 5 test functions |
| 61 | + Verify: grep -c '^test_setup_' $(git rev-parse --show-toplevel)/tests/scripts/test-dso-setup.sh | awk '{exit ($1 < 5)}' |
| 62 | +- [ ] Tests fail before setup script exists |
| 63 | + Verify: bash $(git rev-parse --show-toplevel)/tests/scripts/test-dso-setup.sh 2>&1 | grep -q 'FAIL' |
| 64 | + |
0 commit comments