test(pdf-exporter): increase unit test coverage for pdf-exporter.ts#17079
test(pdf-exporter): increase unit test coverage for pdf-exporter.ts#17079
Conversation
Add 19 new pure unit tests targeting previously uncovered code paths in pdf-exporter.ts: - GroupedRecord type export (lines covering isSummaryRecord check) - Summary records with unrecognized/null cellValue format (drawDataRow fall-through) - Pagination with multi-level column headers (header redraw on page break) - Pivot grid with showTableBorders=false (else branches in drawMultiLevelHeaders) - Pivot grid pagination triggering hasMultiRowHeaders redraw path - drawHierarchicalChildren early return when all children are HeaderRecord - Child table header/row page break scenarios - Pivot grid row dimension headers filling from RowHeader cols and field names - Tree grid with DataRecord records mixed in for indentation - Custom font success path (valid name+data, with/without bold variant)" Co-authored-by: ChronosSF <2188411+ChronosSF@users.noreply.github.com> Agent-Logs-Url: https://github.com/IgniteUI/igniteui-angular/sessions/dff68fbc-0dd3-4b9b-b4a7-58418072e7c3
|
@copilot, we are not increasing the coverage substantially. Looking at the coveralls report it seems we are missing lines handling pivot and hierarchical grids, especially fallback lines (see from comments). Can you check exporting tests (for excel / csv exporters) testing pivot/hierarchical grids to try and implement more testing scenarios. If you can you can try to get the lines that need covering from here: https://coveralls.io/builds/78400997/source?filename=projects%2Figniteui-angular%2Fgrids%2Fcore%2Fsrc%2Fservices%2Fpdf%2Fpdf-exporter.ts |
…rid coverage Co-authored-by: ChronosSF <2188411+ChronosSF@users.noreply.github.com> Agent-Logs-Url: https://github.com/IgniteUI/igniteui-angular/sessions/a378e8c4-70b0-422c-88d6-e916b62ae333
Added 17 new integration tests in Hierarchical Grid with Multi-Column Headers — exercises Hierarchical Grid Edge Cases — covers SummaryRecord handling in child grids ( Tree Grid Summaries — expanded tree grid with summaries ( Pivot Grid Hierarchical Row Dimensions — uses Warning Firewall rules blocked me from connecting to one or more addresses (expand for details)I tried to connect to the following addresses, but was blocked by firewall rules:
If you need me to access, download, or install something from one of these locations, you can either:
|
pdf-exporter.tshad several untested code branches. This PR adds pure unit tests and grid-based integration tests across newdescribeblocks targeting those paths.New coverage areas
Pure unit tests (
pdf-exporter.spec.ts)GroupedRecordtype — verified rendered as regular data rows (no special-case handling)drawDataRowpath whencellValuehas none oflabel,value, orsummaryResultproperties; also nullcellValuehasMultiColumnHeaders=true(lines 349–362), with and without bordersshowTableBorders=falseexercises theelsebranches insidedrawMultiLevelHeaders; also pivot pagination covering thehasMultiRowHeadersredraw pathdrawHierarchicalChildrenwhen all direct children areHeaderRecordhasMultiColumnHeadersredraw branch at lines 785–793)RowHeadercolumns (lines 163–172) and falls back to field names (lines 175–178) when no matching columns existDataRecordrecords nested inside a tree export receive indentation (via theisTreeGridExportflag)name+dataenters thetryblock (lines 232–237); variants with and without aboldsub-font cover the conditional at lines 238–246Grid-based integration tests (
pdf-exporter-grid.spec.ts)Following the same patterns used by the Excel/CSV exporter grid test suites, these tests use real Angular component fixtures to exercise deeper fallback paths in pivot and hierarchical grid handling:
IgxHierarchicalGridMultiColumnHeadersExportComponent) and child-island-only MCH (IgxHierarchicalGridMultiColumnHeaderIslandsExportComponent), both with and without expanded rows; exercisesdrawHierarchicalChildrenwith multi-level header redrawsIgxHierarchicalGridSummariesExportComponent), empty data (IgxHierarchicalGridEmptyDataExportComponent), and missing child data key (IgxHierarchicalGridMissingChildDataExportComponent, exercises "owner not in_ownersMap" fallback)IgxTreeGridSummariesKeyComponent)SALES_DATAwith a 3-level hierarchical row configuration (mirroring the Excel exporter tests), covering thehasMultiRowHeaders=truepath, row dimension header building (lines 144–178), andshowTableBorders=falseelse branches indrawMultiLevelHeadersAll tests follow the existing pattern: direct
IgxPdfExporterServiceinstantiation, spy onExportUtilities.saveBlobToFile, assertexportEndedemission.✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.