Skip to content

Commit b2155eb

Browse files
committed
Address SDK bump review feedback
1 parent cf93d01 commit b2155eb

5 files changed

Lines changed: 54 additions & 6 deletions

File tree

internal/commands/board_test.go

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -404,9 +404,13 @@ func TestBoardUpdate(t *testing.T) {
404404
if mock.PatchCalls[0].Path != "/boards/123" {
405405
t.Errorf("expected path '/boards/123', got '%s'", mock.PatchCalls[0].Path)
406406
}
407-
if got := responseDataMap(t, result)["name"]; got != "Updated Name" {
407+
data := responseDataMap(t, result)
408+
if got := data["name"]; got != "Updated Name" {
408409
t.Errorf("expected update response body name, got %#v", got)
409410
}
411+
if got := data["id"]; got != "123" {
412+
t.Errorf("expected update response body id, got %#v", got)
413+
}
410414
})
411415

412416
t.Run("handles API error", func(t *testing.T) {

internal/commands/column_test.go

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -282,9 +282,13 @@ func TestColumnUpdate(t *testing.T) {
282282
if mock.PatchCalls[0].Path != "/boards/123/columns/col-1" {
283283
t.Errorf("expected path '/boards/123/columns/col-1', got '%s'", mock.PatchCalls[0].Path)
284284
}
285-
if got := responseDataMap(t, result)["name"]; got != "Updated Column" {
285+
data := responseDataMap(t, result)
286+
if got := data["name"]; got != "Updated Column" {
286287
t.Errorf("expected update response body name, got %#v", got)
287288
}
289+
if got := data["id"]; got != "col-1" {
290+
t.Errorf("expected update response body id, got %#v", got)
291+
}
288292
})
289293

290294
t.Run("requires board flag", func(t *testing.T) {

internal/commands/identity.go

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -53,18 +53,25 @@ var identityTimezoneUpdateCmd = &cobra.Command{
5353
return newRequiredFlagError("timezone")
5454
}
5555

56-
_, err := getSDKClient().Identity().UpdateMyTimezone(cmd.Context(), cfg.Account, &generated.UpdateMyTimezoneRequest{
56+
resp, err := getSDKClient().Identity().UpdateMyTimezone(cmd.Context(), cfg.Account, &generated.UpdateMyTimezoneRequest{
5757
TimezoneName: identityTimezoneUpdateTimezone,
5858
})
5959
if err != nil {
6060
return convertSDKError(err)
6161
}
6262

63+
data := any(map[string]any{"timezone_name": identityTimezoneUpdateTimezone})
64+
if resp != nil && len(resp.Data) > 0 {
65+
if normalized := normalizeAny(resp.Data); normalized != nil {
66+
data = normalized
67+
}
68+
}
69+
6370
breadcrumbs := []Breadcrumb{
6471
breadcrumb("show", "fizzy identity show", "View identity"),
6572
}
6673

67-
printMutation(map[string]any{"timezone_name": identityTimezoneUpdateTimezone}, "Timezone updated", breadcrumbs)
74+
printMutation(data, "Timezone updated", breadcrumbs)
6875
return nil
6976
},
7077
}

internal/commands/identity_test.go

Lines changed: 30 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,13 @@ import (
1010
func TestIdentityTimezoneUpdate(t *testing.T) {
1111
t.Run("updates timezone", func(t *testing.T) {
1212
mock := NewMockClient()
13-
mock.PatchResponse = &client.APIResponse{StatusCode: 204, Data: nil}
13+
mock.PatchResponse = &client.APIResponse{
14+
StatusCode: 200,
15+
Data: map[string]any{
16+
"timezone_name": "America/New_York",
17+
"updated_at": "2026-06-03T21:15:00Z",
18+
},
19+
}
1420

1521
result := SetTestModeWithSDK(mock)
1622
SetTestConfig("token", "account", "https://api.example.com")
@@ -42,6 +48,29 @@ func TestIdentityTimezoneUpdate(t *testing.T) {
4248
if result.Response.Summary != "Timezone updated" {
4349
t.Errorf("expected timezone summary, got %q", result.Response.Summary)
4450
}
51+
if got := responseDataMap(t, result)["updated_at"]; got != "2026-06-03T21:15:00Z" {
52+
t.Errorf("expected timezone response body updated_at, got %#v", got)
53+
}
54+
})
55+
56+
t.Run("falls back to requested timezone for empty response", func(t *testing.T) {
57+
mock := NewMockClient()
58+
mock.PatchResponse = &client.APIResponse{StatusCode: 204, Data: nil}
59+
60+
result := SetTestModeWithSDK(mock)
61+
SetTestConfig("token", "account", "https://api.example.com")
62+
identityTimezoneUpdateTimezone = "America/New_York"
63+
defer func() {
64+
identityTimezoneUpdateTimezone = ""
65+
resetTest()
66+
}()
67+
68+
err := identityTimezoneUpdateCmd.RunE(identityTimezoneUpdateCmd, []string{})
69+
assertExitCode(t, err, 0)
70+
71+
if got := responseDataMap(t, result)["timezone_name"]; got != "America/New_York" {
72+
t.Errorf("expected fallback timezone_name, got %#v", got)
73+
}
4574
})
4675

4776
t.Run("requires timezone", func(t *testing.T) {

internal/commands/user_test.go

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -107,9 +107,13 @@ func TestUserUpdate(t *testing.T) {
107107
if body["name"] != "New Name" {
108108
t.Errorf("expected name 'New Name', got '%v'", body["name"])
109109
}
110-
if got := responseDataMap(t, result)["name"]; got != "New Name" {
110+
data := responseDataMap(t, result)
111+
if got := data["name"]; got != "New Name" {
111112
t.Errorf("expected update response body name, got %#v", got)
112113
}
114+
if got := data["id"]; got != "user-1" {
115+
t.Errorf("expected update response body id, got %#v", got)
116+
}
113117
})
114118

115119
t.Run("updates user avatar via multipart", func(t *testing.T) {

0 commit comments

Comments
 (0)