MCPcopy Create free account
hub / github.com/github/gh-aw / TestRenderTable

Function TestRenderTable

pkg/console/console_test.go:220–297  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

218}
219
220func TestRenderTable(t *testing.T) {
221 tests := []struct {
222 name string
223 config TableConfig
224 expected []string // Substrings that should be present in output
225 }{
226 {
227 name: "simple table",
228 config: TableConfig{
229 Headers: []string{"ID", "Name", "Status"},
230 Rows: [][]string{
231 {"1", "Test", "Active"},
232 {"2", "Demo", "Inactive"},
233 },
234 },
235 expected: []string{
236 "ID",
237 "Name",
238 "Status",
239 "Test",
240 "Demo",
241 "Active",
242 "Inactive",
243 },
244 },
245 {
246 name: "table with title and total",
247 config: TableConfig{
248 Title: "Workflow Results",
249 Headers: []string{"Run", "Duration", "Cost"},
250 Rows: [][]string{
251 {"123", "5m", "$0.50"},
252 {"456", "3m", "$0.30"},
253 },
254 ShowTotal: true,
255 TotalRow: []string{"TOTAL", "8m", "$0.80"},
256 },
257 expected: []string{
258 "Workflow Results",
259 "Run",
260 "Duration",
261 "Cost",
262 "123",
263 "456",
264 "TOTAL",
265 "8m",
266 "$0.80",
267 },
268 },
269 {
270 name: "empty table",
271 config: TableConfig{
272 Headers: []string{},
273 Rows: [][]string{},
274 },
275 expected: []string{}, // Should return empty string
276 },
277 }

Callers

nothing calls this directly

Calls 3

RenderTableFunction · 0.70
RunMethod · 0.45
ErrorfMethod · 0.45

Tested by

no test coverage detected