Update license table headings and tests

This commit is contained in:
bagtoad 2024-09-29 11:59:15 -06:00
parent 2b4464a3af
commit 25cdce2cec
2 changed files with 11 additions and 11 deletions

View file

@ -66,7 +66,7 @@ func listRun(opts *ListOptions) error {
}
func renderLicenseTemplatesTable(licenses []api.License, opts *ListOptions) error {
t := tableprinter.New(opts.IO, tableprinter.WithHeader("KEY", "NAME"))
t := tableprinter.New(opts.IO, tableprinter.WithHeader("LICENSE KEY", "LICENSE NAME"))
for _, l := range licenses {
t.AddField(l.Key)
t.AddField(l.Name)

View file

@ -133,14 +133,14 @@ func TestListRun(t *testing.T) {
))
},
wantStdout: heredoc.Doc(`
KEY NAME
mit MIT License
lgpl-3.0 GNU Lesser General Public License v3.0
mpl-2.0 Mozilla Public License 2.0
agpl-3.0 GNU Affero General Public License v3.0
unlicense The Unlicense
apache-2.0 Apache License 2.0
gpl-3.0 GNU General Public License v3.0
LICENSE KEY LICENSE NAME
mit MIT License
lgpl-3.0 GNU Lesser General Public License v3.0
mpl-2.0 Mozilla Public License 2.0
agpl-3.0 GNU Affero General Public License v3.0
unlicense The Unlicense
apache-2.0 Apache License 2.0
gpl-3.0 GNU General Public License v3.0
`),
wantStderr: "",
opts: &ListOptions{},
@ -189,8 +189,8 @@ func TestListRun(t *testing.T) {
return
}
assert.Equal(t, tt.wantStdout, stdout.String(), "Stdout differs from expected")
assert.Equal(t, tt.wantStderr, stderr.String(), "Stderr differs from expected")
assert.Equal(t, tt.wantStdout, stdout.String())
assert.Equal(t, tt.wantStderr, stderr.String())
})
}
}