test(*): target testing low coverage parts of the code - #17537
Conversation
kdinev
left a comment
There was a problem hiding this comment.
Looks good! .9% bump is also very good. We should add more!
There was a problem hiding this comment.
🟡 Changes recommended
Some tests use nondeterministic wall-clock behavior, and PDF fixtures do not exercise or verify the fallback paths they claim to cover.
Get a fresh assessment by requesting another Copilot review.
Pull request overview
Adds unit coverage for low-coverage navigation, export, directive, data-operation, and utility code paths.
Changes:
- Expands pivot keyboard and PDF exporter tests.
- Adds drag-selection and child-scroll directive coverage.
- Covers sorting, merging, filtering, and utility edge cases.
File summaries
| File | Description |
|---|---|
pivot-grid-keyboard-nav.spec.ts |
Adds vertical row-header navigation tests. |
pdf-exporter.spec.ts |
Tests pivot, hierarchical, summary, and truncation exports. |
drag-select.directive.spec.ts |
Adds drag-scroll behavior tests. |
scroll_inertia.directive.spec.ts |
Covers nested scrollable elements. |
sorting-strategy.spec.ts |
Tests sorting strategy variants. |
merge-strategy.spec.ts |
Adds merge strategy coverage. |
filtering-condition.spec.ts |
Covers date/time and nested conditions. |
utils.spec.ts |
Expands utility function coverage. |
Review details
- Files reviewed: 8/8 changed files
- Comments generated: 3
- Review effort level: Lite
💡 Add a code-review agent skill for context-aware, tailored reviews. Learn more in the docs.
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Co-authored-by: kdinev <1472513+kdinev@users.noreply.github.com>
Co-authored-by: kdinev <1472513+kdinev@users.noreply.github.com>
There was a problem hiding this comment.
🟡 Changes recommended
The PDF test helper strips pivot dimension data before rendering, causing fallback tests to fail and leaving several behavior tests insufficiently verified.
Get a fresh assessment by requesting another Copilot review.
Review details
Suppressed comments (6)
projects/igniteui-angular/grids/core/src/services/pdf/pdf-exporter.spec.ts:627
- This test only verifies that a PDF was emitted, so it cannot detect that the fixture has one row-header column (
Product A) for two records and the record-index fallback consequently rendersProduct Afor both rows. Assert the rendered text for both Product A and Product B, and provide row-header metadata that represents both values.
exporter.exportEnded.pipe(first()).subscribe((args) => {
expect(ExportUtilities.saveBlobToFile).toHaveBeenCalledTimes(1);
expect(args.pdf).toBeDefined();
done();
projects/igniteui-angular/grids/core/src/services/pdf/pdf-exporter.spec.ts:847
- The test name promises coverage of child, grandchild, and collapsed-row behavior, but checking only that a PDF exists remains green if child recursion is skipped or
Collapsed childis rendered. Assert the rendered text contains Child A, Grandchild of A, and Child B, and does not contain Collapsed child.
exporter.exportEnded.pipe(first()).subscribe((args) => {
expect(ExportUtilities.saveBlobToFile).toHaveBeenCalledTimes(1);
expect(args.pdf).toBeDefined();
done();
});
projects/igniteui-angular/grids/core/src/services/pdf/pdf-exporter.spec.ts:947
- The summary records are never inspected, so the
SummaryRecordconversion can be removed or produce the wrong label/value formatting while this test still passes. Assert the rendered text includesCount: 2,Avg: 27.5, the label-only/value-only cases, and5fromsummaryResult.
exporter.exportEnded.pipe(first()).subscribe((args) => {
expect(ExportUtilities.saveBlobToFile).toHaveBeenCalledTimes(1);
expect(args.pdf).toBeDefined();
done();
});
projects/igniteui-angular/grids/core/src/services/pdf/pdf-exporter.spec.ts:983
- This test only checks that export completes, so removing the header/cell truncation loops would not be detected. Spy on
jsPDF.textand assert that at least one rendered string ends with...(ideally verify both header and cell values).
exporter.exportEnded.pipe(first()).subscribe((args) => {
expect(ExportUtilities.saveBlobToFile).toHaveBeenCalledTimes(1);
expect(args.pdf).toBeDefined();
done();
});
projects/igniteui-angular/grids/core/src/services/pdf/pdf-exporter.spec.ts:895
- This only asserts export completion, not the behavior named by the test. A broken empty-island check could still pass while drawing the child row; spy on
drawDataRowand assert that only the root row is rendered.
exporter.exportEnded.pipe(first()).subscribe((args) => {
expect(ExportUtilities.saveBlobToFile).toHaveBeenCalledTimes(1);
expect(args.pdf).toBeDefined();
done();
});
projects/igniteui-angular/grids/core/src/services/pdf/pdf-exporter.spec.ts:767
exportGridRecordsDatastripsProductfromrecord.data; with nodimensionKeys,rowDimensionFieldsis therefore empty becauseCity-London-Sumis excluded, so this test never enters the row-dimension fallback it claims to cover. After preserving the input data, thePivotMergedHeaderplusrecordIndexwould still selectUnmatchedbefore the record-key fallback. Redesign the fixture to make the intended branch reachable and assert the rendered value.
(exporter as any)._ownersMap.set(DEFAULT_OWNER, pivotOwner([
{
header: 'Unmatched', field: 'Unmatched', skip: false,
headerType: ExportHeaderType.PivotMergedHeader, level: 0, startIndex: 0,
columnSpan: 1, columnGroup: 'AlsoUnmatched'
- Files reviewed: 8/8 changed files
- Comments generated: 2
- Review effort level: Lite
Co-authored-by: kdinev <1472513+kdinev@users.noreply.github.com>
There was a problem hiding this comment.
🔵 Needs a closer look
Several new tests only verify PDF creation or use weaker-than-claimed assertions, leaving targeted behavior insufficiently covered.
Review details
Suppressed comments (8)
Previously missed (3) — in code that hasn't changed since the last review.
projects/igniteui-angular/grids/core/src/selection/drag-select.directive.spec.ts:166
- This reactivation uses a different edge, so it does not cover re-entering the same zone. The
activeDragsetter unsubscribes without resettinglastDirection; after deactivation, re-entering the original edge hits the equality guard and never resubscribes. Exercise the same edge here and reset the direction when deactivating if that scenario is supported.
projects/igniteui-angular/grids/core/src/services/pdf/pdf-exporter.spec.ts:781 - This test only checks that a PDF was produced, so it remains green if the no-
dimensionKeysinference path fails and the row dimension is omitted. Assert the rendered text contains the inferredProduct Avalue (and the100data value) to verify the matching-field fallback.
This issue also appears in the following locations of the same file:
- line 810
- line 878
- line 926
- line 978
- line 1014
projects/igniteui-angular/grids/pivot-grid/src/pivot-grid-keyboard-nav.spec.ts:648
- This only proves that Ctrl+ArrowDown moved past row 1; it will still pass if navigation stops at any intermediate row, despite the test claiming the last row. Assert against the container's final index (
igxForOf!.length - 1) so the Ctrl-to-end behavior is actually covered.
projects/igniteui-angular/grids/core/src/services/pdf/pdf-exporter.spec.ts:813
- This is also only a PDF-existence assertion, so it cannot detect that the simple-key fallback is broken; the current fixture could export successfully with an empty or incorrect dimension cell. Assert the generated row/header text, or adjust the fixture so the inferred simple key is observable, before treating this branch as covered.
exporter.exportEnded.pipe(first()).subscribe((args) => {
expect(ExportUtilities.saveBlobToFile).toHaveBeenCalledTimes(1);
expect(args.pdf).toBeDefined();
done();
projects/igniteui-angular/grids/core/src/services/pdf/pdf-exporter.spec.ts:981
- The test title says every summary-result shape is rendered, but it only asserts PDF creation. The conversion branches for
label+value, label-only, value-only, empty, andsummaryResultcould all regress without failing this test; assert the rendered strings for those cases.
exporter.exportEnded.pipe(first()).subscribe((args) => {
expect(ExportUtilities.saveBlobToFile).toHaveBeenCalledTimes(1);
expect(args.pdf).toBeDefined();
done();
projects/igniteui-angular/grids/core/src/services/pdf/pdf-exporter.spec.ts:1017
- This only checks that the export completes, not that truncation occurred. A regression in the ellipsis loop would pass unchanged; inspect the rendered text and assert the long headers/cells are shortened and end in
....
exporter.exportEnded.pipe(first()).subscribe((args) => {
expect(ExportUtilities.saveBlobToFile).toHaveBeenCalledTimes(1);
expect(args.pdf).toBeDefined();
done();
projects/igniteui-angular/grids/core/src/services/pdf/pdf-exporter.spec.ts:881
- The child/grandchild-island and hidden-row behavior is not asserted here; any traversal that drops children or renders
Collapsed childwould still emit a PDF and pass. Check the rendered text for the parent, child, and grandchild values and explicitly verify the collapsed value is absent.
exporter.exportEnded.pipe(first()).subscribe((args) => {
expect(ExportUtilities.saveBlobToFile).toHaveBeenCalledTimes(1);
expect(args.pdf).toBeDefined();
done();
projects/igniteui-angular/grids/core/src/services/pdf/pdf-exporter.spec.ts:929
- This only verifies that exporting an empty island does not throw; it does not prove that the island's child row is skipped. Assert the PDF text does not contain the empty island's
ChildId/row value while still containing the root row.
exporter.exportEnded.pipe(first()).subscribe((args) => {
expect(ExportUtilities.saveBlobToFile).toHaveBeenCalledTimes(1);
expect(args.pdf).toBeDefined();
done();
- Files reviewed: 9/9 changed files
- Comments generated: 0 new
- Review effort level: Lite
Closes #
Description
Motivation / Context
Type of Change (check all that apply):
Component(s) / Area(s) Affected:
How Has This Been Tested?
Test Configuration:
Screenshots / Recordings
Checklist:
feature/README.MDupdates for the feature docsREADME.MDCHANGELOG.MDupdates for newly added functionalityng updatemigrations for the breaking changes (migrations guidelines)