@@ -1,15 +1,13 @@
1package model
1package model
8 "charm.land/catwalk/pkg/catwalk"
6 "charm.land/catwalk/pkg/catwalk"
9− "github.com/charmbracelet/crush/internal/app"
10 "github.com/charmbracelet/crush/internal/config"
7 "github.com/charmbracelet/crush/internal/config"
11 "github.com/charmbracelet/crush/internal/csync"
8 "github.com/charmbracelet/crush/internal/csync"
12 "github.com/charmbracelet/crush/internal/ui/common"
9 "github.com/charmbracelet/crush/internal/ui/common"
10+ "github.com/charmbracelet/crush/internal/workspace"
13 "github.com/stretchr/testify/require"
11 "github.com/stretchr/testify/require"
@@ -79,29 +77,19 @@ func TestCurrentModelSupportsImages(t *testing.T) {
79func newTestUIWithConfig(t *testing.T, cfg *config.Config) *UI {
77func newTestUIWithConfig(t *testing.T, cfg *config.Config) *UI {
80 t.Helper()
78 t.Helper()
82− store := &config.ConfigStore{}
83− setUnexportedField(t, store, "config", cfg)
85− appInstance := &app.App{}
86− setUnexportedField(t, appInstance, "config", store)
88 return &UI{
80 return &UI{
89 com: &common.Common{
81 com: &common.Common{
90− App: appInstance,
82+ Workspace: &testWorkspace{cfg: cfg},
95−func setUnexportedField(t *testing.T, target any, name string, value any) {
87+// testWorkspace is a minimal [workspace.Workspace] stub for unit tests.
96− t.Helper()
88+type testWorkspace struct {
97−
89+ workspace.Workspace
98− v := reflect.ValueOf(target)
90+ cfg *config.Config
99− require.Equal(t, reflect.Pointer, v.Kind())
91+}
100− require.False(t, v.IsNil())
102− field := v.Elem().FieldByName(name)
103− require.Truef(t, field.IsValid(), "field %q not found", name)
105− fieldValue := reflect.NewAt(field.Type(), unsafe.Pointer(field.UnsafeAddr())).Elem()
93+func (w *testWorkspace) Config() *config.Config {
106− fieldValue.Set(reflect.ValueOf(value))
94+ return w.cfg