Skip to content

chore: EPINIO-790 unit test shared utils - #668

Merged
dcharles525 merged 1 commit into
1.14.4from
feat/EPINIO-790_unit_tests_shared_utils
Nov 2, 2026
Merged

dcharles525 merged 1 commit into
1.14.4from
feat/EPINIO-790_unit_tests_shared_utils

Conversation

@Hannahbird

@Hannahbird Hannahbird commented Oct 30, 2026 •

Copy link
Copy Markdown
Contributor

Add Jest coverage for table-formatters, permissions, namespaces, application, custom-routing and embedded-helpers (116 tests).

Move each util into a folder with an index.ts barrel to match trailhand-ui's layout. Importers are unchanged.

Swap application.ts off @shell/utils/url to the local utils/url copy.

Add @types/jest, @types/node and @types/webpack-env as devDependencies and fix the tsconfig types list so tsc --noEmit runs clean.

PR Checklist

  • Linting Test is passing
  • Code is well documented
  • If applicable, a PR in the epinio/docs repository has been opened

Summary

Fixes EPINIO-790

Adds unit tests for the shared dashboard utils. These are pure helpers with no DOM or Vuex setup needed. table-formatters was the priority since every migrated table uses it.

Occurred changes and/or fixed issues

  • New Jest tests (116 total) for:
    • utils/table-formatters: all exports, including link building and router push, action menu caching and action wrapping, state to tag/icon mapping, commit cells, progress cells, and the row override helpers
    • utils/permissions: role to permission mapping, including cluster-scoped actions being withheld from namespaced roles
    • utils/application: source type mapping, git URL parsing, sourceFingerprint
    • utils/namespaces: useNamespaces against a mocked store (fetch, cache, search, seed, active namespace filter)
    • utils/custom-routing and utils/embedded-helpers
  • Moved permissions, namespaces, application, custom-routing and embedded-helpers into per-module folders with an index.ts barrel, matching the table-formatters layout (and trailhand-ui's). Importers are unchanged since utils/foo resolves to the folder's index.
  • utils/application now imports parse from the local utils/url instead of @shell/utils/url. The two implementations are identical.
  • Added @types/jest, @types/node and @types/webpack-env as devDependencies and fixed the types list in pkg/epinio/tsconfig.json. Before this, tsc failed on startup because of the missing type packages.

Technical notes summary

  • @types/node is pinned to ~20.10.0 to match the existing resolutions entry.
  • The tsconfig listed bare node and webpack-env, but typeRoots points at node_modules, not node_modules/@types, so those never resolved. They're now @types/webpack-env and @types/node.
  • tsc --noEmit -p pkg/epinio/tsconfig.json now runs clean (0 errors). It isn't wired into CI yet.
  • ts-jest runs with isolatedModules, so yarn test doesn't type-check. Use tsc for that.
  • overrideTableRowProp defines non-enumerable props, so the tests check them directly instead of with toEqual.

Areas or cases that should be tested

  • yarn test in dashboard/: 116 passing.
  • npx tsc --noEmit -p pkg/epinio/tsconfig.json: 0 errors.
  • Build or run the extension and open the apps, services, configurations, namespaces and app chart lists to confirm the moved utils still resolve in webpack. models/services.js and models/catalogservices.js import through the @pkg/utils/custom-routing alias, which Jest doesn't exercise.
  • App create and edit with a git source, which goes through getGitData and its new utils/url import.

Areas which could experience regressions

  • Anything importing the moved utils: route building (custom-routing), permission gating on create/edit/delete buttons (permissions), namespace pickers (namespaces), app source detection and redeploy diffing (application), and the dashboard URL in embedded mode (embedded-helpers). Logic in all of these is unchanged. Only file locations and import paths moved.

Screenshot/Video

N/A, tests and tooling only.

@Hannahbird
Hannahbird force-pushed the feat/EPINIO-790_unit_tests_shared_utils branch from 5e73bac to f291e6f Compare October 30, 2026 18:12
@Hannahbird
Hannahbird changed the base branch from 1.14.3 to 1.14.4 October 30, 2026 18:12
Add Jest coverage for table-formatters, permissions, namespaces,
application, custom-routing and embedded-helpers (116 tests).

Move each util into a folder with an index.ts barrel to match
trailhand-ui's layout. Importers are unchanged.

Swap application.ts off @shell/utils/url to the local utils/url copy.

Add @types/jest, @types/node and @types/webpack-env as devDependencies
and fix the tsconfig types list so tsc --noEmit runs clean.
@Hannahbird
Hannahbird force-pushed the feat/EPINIO-790_unit_tests_shared_utils branch 2 times, most recently from f291e6f to b47e4e9 Compare October 30, 2026 18:18

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

LGTM

@dcharles525
dcharles525 merged commit e32fe13 into 1.14.4 Nov 2, 2026
6 of 8 checks passed
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.

2 participants