Skip to content

test(frontend): add FormlyRepeatDndComponent unit tests#5632

Open
lie18uci wants to merge 2 commits into
apache:mainfrom
lie18uci:test/5464-formly-repeat-dnd
Open

test(frontend): add FormlyRepeatDndComponent unit tests#5632
lie18uci wants to merge 2 commits into
apache:mainfrom
lie18uci:test/5464-formly-repeat-dnd

Conversation

@lie18uci

Copy link
Copy Markdown
Contributor

What changes were proposed in this PR?

This PR adds frontend unit tests for FormlyRepeatDndComponent.
The new spec verifies that:

  • The component is created successfully.
  • onDrop does nothing when previousIndex == currentIndex.
  • onDrop does nothing when model is undefined.
  • onDrop reorders model, field.fieldGroup, and formControl on the happy path.
  • props.reorder is called after a successful reorder.
    This improves test coverage for the drag-and-drop reorder behavior without changing existing component behavior.

Any related issues, documentation, discussions?

Closes #5464

How was this PR tested?

Ran the following command locally from the frontend directory:
yarn test --include='**/repeat-dnd.component.spec.ts'

The test passed successfully with 1 test file passed and 4 tests passed.
Also ran:
yarn lint

^ yarn lint completed successfully.

Was this PR authored or co-authored using generative AI tooling?

Generated-by: ChatGPT

@github-actions github-actions Bot added the frontend Changes related to the frontend GUI label Jun 12, 2026
@lie18uci

Copy link
Copy Markdown
Contributor Author

/request-review @Ma77Ball

@codecov-commenter

codecov-commenter commented Jun 12, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 52.58%. Comparing base (d76a51e) to head (5cbf806).
⚠️ Report is 1 commits behind head on main.

Additional details and impacted files
@@             Coverage Diff              @@
##               main    #5632      +/-   ##
============================================
- Coverage     52.78%   52.58%   -0.21%     
+ Complexity     2495     2479      -16     
============================================
  Files          1073     1072       -1     
  Lines         41382    41308      -74     
  Branches       4444     4440       -4     
============================================
- Hits          21843    21720     -123     
- Misses        18257    18311      +54     
+ Partials       1282     1277       -5     
Flag Coverage Δ *Carryforward flag
access-control-service 64.61% <ø> (ø) Carriedforward from 5b02684
agent-service 33.34% <ø> (-1.02%) ⬇️ Carriedforward from 5b02684
amber 53.29% <ø> (-0.07%) ⬇️ Carriedforward from 5b02684
computing-unit-managing-service 1.65% <ø> (ø) Carriedforward from 5b02684
config-service 55.38% <ø> (-1.34%) ⬇️ Carriedforward from 5b02684
file-service 39.34% <ø> (-17.73%) ⬇️ Carriedforward from 5b02684
frontend 47.42% <ø> (+0.11%) ⬆️
pyamber 90.72% <ø> (ø) Carriedforward from 5b02684
python 90.75% <ø> (ø) Carriedforward from 5b02684
workflow-compiling-service 58.69% <ø> (ø) Carriedforward from 5b02684

*This pull request uses carry forward flags. Click here to find out more.

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@xuang7 xuang7 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.

LGTM, left one minor comment.

import { CdkDragDrop } from "@angular/cdk/drag-drop";
import { FormArray, FormControl } from "@angular/forms";
import { ComponentFixture, TestBed } from "@angular/core/testing";
import { vi } from "vitest";

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.

This import may not be needed since vi is available globally.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

frontend Changes related to the frontend GUI

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add unit tests for FormlyRepeatDndComponent

3 participants