(t *testing.T)
| 420 | } |
| 421 | |
| 422 | func TestUpdateInvalidVersion_JSON(t *testing.T) { |
| 423 | f, stdout, _ := newTestFactory(t) |
| 424 | cmd := NewCmdUpdate(f) |
| 425 | cmd.SetArgs([]string{"--json"}) |
| 426 | |
| 427 | origFetch := fetchLatest |
| 428 | fetchLatest = func() (string, error) { return "not-a-version", nil } |
| 429 | defer func() { fetchLatest = origFetch }() |
| 430 | |
| 431 | _ = cmd.Execute() |
| 432 | out := stdout.String() |
| 433 | if !strings.Contains(out, "invalid version") { |
| 434 | t.Errorf("expected 'invalid version' in JSON output, got: %s", out) |
| 435 | } |
| 436 | } |
| 437 | |
| 438 | func TestUpdateDevVersion_JSON(t *testing.T) { |
| 439 | // Same state-isolation rationale as TestUpdateNpm_JSON. |
nothing calls this directly
no test coverage detected