(t *testing.T)
| 16 | ) |
| 17 | |
| 18 | func TestNewCmdExtension_Updates(t *testing.T) { |
| 19 | tests := []struct { |
| 20 | name string |
| 21 | extCurrentVersion string |
| 22 | extIsPinned bool |
| 23 | extLatestVersion string |
| 24 | extName string |
| 25 | extUpdateAvailable bool |
| 26 | extURL string |
| 27 | wantStderr string |
| 28 | }{ |
| 29 | { |
| 30 | name: "no update available", |
| 31 | extName: "no-update", |
| 32 | extUpdateAvailable: false, |
| 33 | extCurrentVersion: "1.0.0", |
| 34 | extLatestVersion: "1.0.0", |
| 35 | extURL: "https//github.com/dne/no-update", |
| 36 | }, |
| 37 | { |
| 38 | name: "major update", |
| 39 | extName: "major-update", |
| 40 | extUpdateAvailable: true, |
| 41 | extCurrentVersion: "1.0.0", |
| 42 | extLatestVersion: "2.0.0", |
| 43 | extURL: "https//github.com/dne/major-update", |
| 44 | wantStderr: heredoc.Doc(` |
| 45 | A new release of major-update is available: 1.0.0 → 2.0.0 |
| 46 | To upgrade, run: gh extension upgrade major-update |
| 47 | https//github.com/dne/major-update |
| 48 | `), |
| 49 | }, |
| 50 | { |
| 51 | name: "major update, pinned", |
| 52 | extName: "major-update-pin", |
| 53 | extUpdateAvailable: true, |
| 54 | extCurrentVersion: "1.0.0", |
| 55 | extLatestVersion: "2.0.0", |
| 56 | extIsPinned: true, |
| 57 | extURL: "https//github.com/dne/major-update", |
| 58 | wantStderr: heredoc.Doc(` |
| 59 | A new release of major-update-pin is available: 1.0.0 → 2.0.0 |
| 60 | To upgrade, run: gh extension upgrade major-update-pin --force |
| 61 | https//github.com/dne/major-update |
| 62 | `), |
| 63 | }, |
| 64 | { |
| 65 | name: "minor update", |
| 66 | extName: "minor-update", |
| 67 | extUpdateAvailable: true, |
| 68 | extCurrentVersion: "1.0.0", |
| 69 | extLatestVersion: "1.1.0", |
| 70 | extURL: "https//github.com/dne/minor-update", |
| 71 | wantStderr: heredoc.Doc(` |
| 72 | A new release of minor-update is available: 1.0.0 → 1.1.0 |
| 73 | To upgrade, run: gh extension upgrade minor-update |
| 74 | https//github.com/dne/minor-update |
| 75 | `), |
nothing calls this directly
no test coverage detected