Skip to content

test(calm-widgets): enforce alphabetical ordering for helpers and widget registration#2697

Open
markscott-ms wants to merge 2 commits into
finos:mainfrom
markscott-ms:feat/1501-alphabetical-widget-ordering
Open

test(calm-widgets): enforce alphabetical ordering for helpers and widget registration#2697
markscott-ms wants to merge 2 commits into
finos:mainfrom
markscott-ms:feat/1501-alphabetical-widget-ordering

Conversation

@markscott-ms

@markscott-ms markscott-ms commented Jun 20, 2026

Copy link
Copy Markdown
Contributor

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: asserts Object.keys(registerGlobalTemplateHelpers()) are alphabetically sorted
  • widget-engine.spec.ts: asserts widget IDs passed to registry.register via registerDefaultWidgets() are alphabetically sorted

The source files were reordered to satisfy the tests - by a human using cut and paste.

Type of Change

  • ✅ Test additions or updates
  • 🎨 Code style/formatting changes

Affected Components

  • CALM Widgets (calm-widgets/)

Commit Message Format ✅

test(calm-widgets): enforce alphabetical ordering for helpers and widget registration

Testing

  • I have tested my changes locally
  • I have added/updated unit tests
  • All existing tests pass

Checklist

  • My commits follow the conventional commit format
  • I have updated documentation if necessary
  • I have added tests for my changes (if applicable)
  • My changes follow the project's coding standards

@markscott-ms markscott-ms requested a review from a team as a code owner June 20, 2026 12:55
…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
@markscott-ms markscott-ms force-pushed the feat/1501-alphabetical-widget-ordering branch from cf60c49 to b73b78d Compare June 20, 2026 12:59
@markscott-ms markscott-ms requested a review from Copilot June 20, 2026 13:01

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.

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.

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Enforce Alphabetical Ordering for Widget Helpers and Widgets

2 participants