---
id: TASK-17.3
title: Add tests for sysbuild list and image selection
status: Done
assignee:
  - codex
created_date: '2026-02-27 08:46'
updated_date: '2026-02-27 10:13'
labels: []
dependencies: []
references:
  - src/core/cmd.rs
  - tests/
parent_task_id: TASK-17
---

## Description

<!-- SECTION:DESCRIPTION:BEGIN -->
Add unit tests to cover sysbuild image discovery, list output, image index/name selection, and default image selection behavior.
<!-- SECTION:DESCRIPTION:END -->

## Acceptance Criteria
<!-- AC:BEGIN -->
- [x] #1 Tests cover list output (1-based), index-based image selection, name-based image selection, and default image selection for sysbuild projects.
- [x] #2 Tests cover error cases for invalid image selection and sysbuild flags on non-sysbuild projects.
- [x] #3 `just test` passes.
<!-- AC:END -->

## Implementation Plan

<!-- SECTION:PLAN:BEGIN -->
Plan:
1) Review existing sysbuild-related tests in `src/core/cmd.rs` to confirm coverage of list output, index/name selection, defaults, and error cases.
2) Add any missing tests for list output formatting or non-sysbuild flag errors.
3) Run `just test` to confirm the suite passes.
<!-- SECTION:PLAN:END -->

## Implementation Notes

<!-- SECTION:NOTES:BEGIN -->
Reviewed sysbuild tests in `src/core/cmd.rs`; coverage for list output, index/name selection, defaults, invalid selections, and non-sysbuild flag errors is already present. Ran `just test` (79 passed).
<!-- SECTION:NOTES:END -->

## Final Summary

<!-- SECTION:FINAL_SUMMARY:BEGIN -->
Sysbuild list/image selection tests are already in place covering list formatting (1-based), index/name selection, default selection, and error cases for non-sysbuild flags and invalid selection. `just test` passes.

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