feat: enhance summary pivot specifications to include column fields
All checks were successful
continuous-integration/drone/push Build is passing
All checks were successful
continuous-integration/drone/push Build is passing
This commit is contained in:
@@ -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)
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user