feat: enhance summary pivot specifications to include column fields
All checks were successful
continuous-integration/drone/push Build is passing

This commit is contained in:
2026-02-27 14:11:02 +11:00
parent 504621f80d
commit 3b0dfda992
5 changed files with 172 additions and 45 deletions

View File

@@ -43,10 +43,16 @@ func TestAddSummaryPivotSheetCreatesPivotTables(t *testing.T) {
"PivotProratedVmCount": false,
"PivotVmNameCount": false,
}
var avgVcpuPivot excelize.PivotTableOptions
avgVcpuFound := false
for _, pivot := range pivots {
if _, ok := expectedNames[pivot.Name]; ok {
expectedNames[pivot.Name] = true
}
if pivot.Name == "PivotAvgVcpu" {
avgVcpuPivot = pivot
avgVcpuFound = true
}
if strings.Contains(pivot.DataRange, "'") {
t.Fatalf("pivot %q has quoted DataRange %q; expected unquoted sheet reference", pivot.Name, pivot.DataRange)
}
@@ -59,4 +65,13 @@ func TestAddSummaryPivotSheetCreatesPivotTables(t *testing.T) {
t.Fatalf("missing expected pivot table %q", name)
}
}
if !avgVcpuFound {
t.Fatal("missing PivotAvgVcpu definition")
}
if len(avgVcpuPivot.Rows) != 1 || avgVcpuPivot.Rows[0].Data != "Datacenter" {
t.Fatalf("PivotAvgVcpu rows = %#v; expected Datacenter only", avgVcpuPivot.Rows)
}
if len(avgVcpuPivot.Columns) != 1 || avgVcpuPivot.Columns[0].Data != "ResourcePool" {
t.Fatalf("PivotAvgVcpu columns = %#v; expected ResourcePool only", avgVcpuPivot.Columns)
}
}