(t *testing.T)
| 108 | } |
| 109 | |
| 110 | func TestModelsListCommand_JSONFormat(t *testing.T) { |
| 111 | t.Parallel() |
| 112 | |
| 113 | var buf bytes.Buffer |
| 114 | cmd := newModelsCmd(withTestConfig(map[string]string{"ANTHROPIC_API_KEY": "test-key"})) |
| 115 | cmd.SetOut(&buf) |
| 116 | cmd.SetErr(&buf) |
| 117 | cmd.SetArgs([]string{"--format", "json"}) |
| 118 | |
| 119 | require.NoError(t, cmd.Execute()) |
| 120 | |
| 121 | var rows []modelRow |
| 122 | require.NoError(t, json.Unmarshal(buf.Bytes(), &rows)) |
| 123 | assert.NotEmpty(t, rows) |
| 124 | |
| 125 | // At least one should be the default |
| 126 | hasDefault := false |
| 127 | for _, r := range rows { |
| 128 | if r.Default { |
| 129 | hasDefault = true |
| 130 | break |
| 131 | } |
| 132 | } |
| 133 | assert.True(t, hasDefault, "expected at least one default model") |
| 134 | } |
| 135 | |
| 136 | func TestModelsListCommand_DefaultMarker(t *testing.T) { |
| 137 | t.Parallel() |
nothing calls this directly
no test coverage detected