test(calm-widgets): enforce alphabetical ordering for helpers and widget registration#2697
Open
markscott-ms wants to merge 2 commits into
Open
test(calm-widgets): enforce alphabetical ordering for helpers and widget registration#2697markscott-ms wants to merge 2 commits into
markscott-ms wants to merge 2 commits into
Conversation
…get registration Adds unit tests that assert widget helpers (registerGlobalTemplateHelpers) and default widget registration (registerDefaultWidgets) are in alphabetical order, preventing regressions as the codebase grows. Reorders both to satisfy the tests. Closes finos#1501
cf60c49 to
b73b78d
Compare
Contributor
There was a problem hiding this comment.
Pull request overview
This PR adds unit-test enforcement (issue #1501 Option B) to keep calm-widgets template helper definitions and default widget registration in strict alphabetical order, and reorders the existing source lists to satisfy those tests.
Changes:
- Added a unit test asserting
registerGlobalTemplateHelpers()returns keys in alphabetical order. - Added a unit test asserting
registerDefaultWidgets()registers widgets in alphabetical order by widget id. - Reordered helper definitions and the default widget registration list to match the enforced ordering.
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
| calm-widgets/src/widget-helpers.ts | Reordered helper definitions to be alphabetically keyed. |
| calm-widgets/src/widget-helpers.spec.ts | Added test that fails if helper key ordering is not alphabetical. |
| calm-widgets/src/widget-engine.ts | Reordered default widget registration list to be alphabetical by widget id. |
| calm-widgets/src/widget-engine.spec.ts | Added test that fails if default widget registration order is not alphabetical. |
💡 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.
Description
Closes #1501
Implements Option B (test-based validation) to enforce alphabetical ordering of widget helpers and default widget registration in
calm-widgets.Two unit tests are added that will fail CI if ordering is ever broken:
widget-helpers.spec.ts: assertsObject.keys(registerGlobalTemplateHelpers())are alphabetically sortedwidget-engine.spec.ts: asserts widget IDs passed toregistry.registerviaregisterDefaultWidgets()are alphabetically sortedThe source files were reordered to satisfy the tests - by a human using cut and paste.
Type of Change
Affected Components
calm-widgets/)Commit Message Format ✅
test(calm-widgets): enforce alphabetical ordering for helpers and widget registrationTesting
Checklist