---
id: TASK-30
title: Add unit tests for SPDX BoM config plumbing and command behavior
status: Done
assignee:
  - codex
created_date: '2026-03-04 14:12'
updated_date: '2026-03-04 14:29'
labels: []
dependencies: []
references:
  - src/core/cli.rs
  - src/core/cmd.rs
  - src/config/schema.rs
  - src/core/config.rs
---

## Description

<!-- SECTION:DESCRIPTION:BEGIN -->
Add unit tests to cover SPDX BoM configuration defaults/overrides and command handler behavior for BoM generation.
<!-- SECTION:DESCRIPTION:END -->

## Acceptance Criteria
<!-- AC:BEGIN -->
- [x] #1 CLI parsing covers `bom` with `--list`/`--image` and the `spdx` alias.
- [x] #2 Config/schema or config resolution tests verify BoM defaults and overrides are propagated into `ResolvedConfig` (`bom_build`, `bom_v`).
- [x] #3 `cmd_bom`/`ensure_bom_conf` unit tests cover non-sysbuild list/image errors, sysbuild list success, and `bom_build=false` error without executing external commands (dry-run).
- [x] #4 All new tests pass under `just check`.
- [x] #5 Config schema tests cover `[bom]` defaults and overlay behavior (build flag + version).
<!-- AC:END -->

## Implementation Plan

<!-- SECTION:PLAN:BEGIN -->
1. Add CLI parsing tests for `bom`/`spdx` with `--list` and `--image` in `src/core/cli.rs`.
2. Add config schema tests for `BomCfg` defaults and overlay behavior in `src/config/schema.rs`.
3. Add config resolution tests verifying `bom_build`/`bom_v` propagate into `ResolvedConfig` in `src/core/config.rs`.
4. Add command handler tests for `cmd_bom`/`ensure_bom_conf` covering list/image errors, sysbuild list success, and `bom_build=false` error using dry-run and temp dirs in `src/core/cmd.rs`.
5. Run `just check` and update acceptance criteria in the task.
<!-- SECTION:PLAN:END -->

## Implementation Notes

<!-- SECTION:NOTES:BEGIN -->
Added unit tests for BoM CLI parsing, config schema defaults/overlay, config resolution propagation, and cmd_bom/ensure_bom_conf error/list paths. Ran `just check`.
<!-- SECTION:NOTES:END -->

## Final Summary

<!-- SECTION:FINAL_SUMMARY:BEGIN -->
Summary:
- Added CLI parsing coverage for `bom`/`spdx` including sysbuild args.
- Added config schema tests for `[bom]` defaults and overlay behavior.
- Added config resolution and command handler tests to cover BoM propagation and error/list paths.

Tests:
- `just check`
<!-- SECTION:FINAL_SUMMARY:END -->
