test(frontend): add unit test coverage for calculateTotalTranslate3d#6403
Merged
Conversation
Contributor
Automated Reviewer SuggestionsBased on the
|
Contributor
Author
|
/request-review @aglinxinyuan |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #6403 +/- ##
============================================
- Coverage 69.83% 69.81% -0.02%
Complexity 3380 3380
============================================
Files 1142 1142
Lines 44838 44838
Branches 4949 4949
============================================
- Hits 31311 31303 -8
- Misses 11869 11875 +6
- Partials 1658 1660 +2
*This pull request uses carry forward flags. Click here to find out more. ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
Contributor
There was a problem hiding this comment.
Pull request overview
Adds frontend unit tests to cover the existing calculateTotalTranslate3d utility (a pure parsing/summing helper) without changing production behavior.
Changes:
- Introduced a new spec file to test parsing/summing behavior for
translate3d(...)fragments. - Added coverage for decimals, negatives, multiple fragments, and “no match” / “invalid fragment” cases.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What changes were proposed in this PR?
Adds unit test coverage for the calculateTotalTranslate3d function in frontend/src/app/common/util/panel-dock.ts, which was previously untested. This is a pure function that parses one or more CSS translate3d(...) fragments from a string and returns the component-wise sum of their x/y/z offsets.
A new spec file, frontend/src/app/common/util/panel-dock.spec.ts, was created following the testing style of size-formatter.util.spec.ts. It covers:
Any related issues, documentation, discussions?
Closes #6255
How was this PR tested?
Added 6 unit tests in the new spec file, all passing via ng test:
cd frontend && npx ng test --watch=false --include='**/panel-dock.spec.ts'
src/app/common/util/panel-dock.spec.ts (6 tests) 3ms
Test Files - 1, passed (1)
Tests - 6, passed (6)
Was this PR authored or co-authored using generative AI tooling?
Co-authored with Claude Opus 4.8 in compliance with ASF