refactor: cli: address comments from #4240 (#4259)

This commit is contained in:
Cian Johnston
2022-09-29 11:04:37 +01:00
committed by GitHub
parent 028a4edbd4
commit e6f568fcac
3 changed files with 42 additions and 10 deletions
+22
View File
@@ -327,6 +327,28 @@ baz baz1 baz3 Aug 2 15:49:10
})
}
func Test_TableHeaders(t *testing.T) {
t.Parallel()
s := []tableTest1{}
expectedFields := []string{
"name",
"age",
"roles",
"sub_1_name",
"sub_1_age",
"sub_2_name",
"sub_2_age",
"sub_3_inner_name",
"sub_3_inner_age",
"sub_4",
"time",
"time_ptr",
}
headers, err := cliui.TableHeaders(s)
require.NoError(t, err)
require.EqualValues(t, expectedFields, headers)
}
// compareTables normalizes the incoming table lines
func compareTables(t *testing.T, expected, out string) {
t.Helper()