mirror of
https://github.com/lukaszraczylo/harness-sync.git
synced 2026-10-12 00:45:22 +00:00
- internal/ui/prompts.go: MultiSelect with huh TUI + WithNonInteractive for tests - internal/cli/init.go: NewInit cobra command with --from/--no-prompt flags - internal/cli/init_test.go: TestInitImportWritesCanonical - internal/cli/root.go: add resolveRoot helper (shared by profile/rollback/show/init) - go.mod: add github.com/charmbracelet/huh v1.0.0 as direct dep
19 lines
466 B
Go
19 lines
466 B
Go
package ui
|
|
|
|
import (
|
|
"testing"
|
|
|
|
"github.com/stretchr/testify/assert"
|
|
)
|
|
|
|
func TestMultiSelectNonInteractive(t *testing.T) {
|
|
sel, err := MultiSelect("pick", []string{"a", "b", "c"}, WithNonInteractive([]string{"a", "c"}))
|
|
assert.NoError(t, err)
|
|
assert.Equal(t, []string{"a", "c"}, sel)
|
|
}
|
|
|
|
func TestMultiSelectNonInteractiveInvalidChoice(t *testing.T) {
|
|
_, err := MultiSelect("pick", []string{"a", "b"}, WithNonInteractive([]string{"z"}))
|
|
assert.Error(t, err)
|
|
}
|