Skip to content

test(*): target testing low coverage parts of the code - #17537

Merged
kdinev merged 10 commits into
masterfrom
sstoychev/increase-code-coverage
Sep 17, 2026
Merged

kdinev merged 10 commits into
masterfrom
sstoychev/increase-code-coverage

Conversation

@ChronosSF

Copy link
Copy Markdown
Member

Closes #

Description

Motivation / Context

Type of Change (check all that apply):

  • Bug fix
  • New functionality
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • Refactoring (no functional changes)
  • Documentation
  • Demos
  • CI/CD
  • Tests
  • Changelog
  • Skills/Agents

Component(s) / Area(s) Affected:

How Has This Been Tested?

  • Unit tests
  • Manual testing
  • Automated e2e tests

Test Configuration:

  • Angular version:
  • Browser(s):
  • OS:

Screenshots / Recordings

Checklist:

  • All relevant tags have been applied to this PR
  • This PR includes unit tests covering all the new code (test guidelines)
  • This PR includes API docs for newly added methods/properties (api docs guidelines)
  • This PR includes feature/README.MD updates for the feature docs
  • This PR includes general feature table updates in the root README.MD
  • This PR includes CHANGELOG.MD updates for newly added functionality
  • This PR contains breaking changes
  • This PR includes ng update migrations for the breaking changes (migrations guidelines)
  • This PR includes behavioral changes and the feature specification has been updated with them
  • Accessibility (ARIA, keyboard navigation, focus management) has been verified

kdinev
kdinev previously approved these changes Sep 17, 2026

@kdinev kdinev left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good! .9% bump is also very good. We should add more!

Copilot AI lite review requested due to automatic review settings September 17, 2026 05:47

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 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.

Comment thread projects/igniteui-angular/core/src/data-operations/filtering-condition.spec.ts Outdated
Comment thread projects/igniteui-angular/grids/core/src/services/pdf/pdf-exporter.spec.ts Outdated
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Co-authored-by: kdinev <1472513+kdinev@users.noreply.github.com>
Copilot AI requested a review from kdinev September 17, 2026 06:00
Co-authored-by: kdinev <1472513+kdinev@users.noreply.github.com>

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 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 renders Product A for 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 child is 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 SummaryRecord conversion can be removed or produce the wrong label/value formatting while this test still passes. Assert the rendered text includes Count: 2, Avg: 27.5, the label-only/value-only cases, and 5 from summaryResult.
            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.text and 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 drawDataRow and 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

  • exportGridRecordsData strips Product from record.data; with no dimensionKeys, rowDimensionFields is therefore empty because City-London-Sum is excluded, so this test never enters the row-dimension fallback it claims to cover. After preserving the input data, the PivotMergedHeader plus recordIndex would still select Unmatched before 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

Comment thread projects/igniteui-angular/grids/core/src/selection/drag-select.directive.spec.ts Outdated
Co-authored-by: kdinev <1472513+kdinev@users.noreply.github.com>
@kdinev
kdinev requested a lite review from Copilot September 17, 2026 11:20

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🔵 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 activeDrag setter unsubscribes without resetting lastDirection; 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-dimensionKeys inference path fails and the row dimension is omitted. Assert the rendered text contains the inferred Product A value (and the 100 data 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, and summaryResult could 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 child would 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

@kdinev
kdinev merged commit 3198313 into master Sep 17, 2026
7 checks passed
@kdinev
kdinev deleted the sstoychev/increase-code-coverage branch September 17, 2026 12:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants