Repository navigation
chore: EPINIO-790 unit test shared utils - #668
Merged
Merged
Conversation
Hannahbird
force-pushed
the
feat/EPINIO-790_unit_tests_shared_utils
branch
from
October 30, 2026 18:12
5e73bac to
f291e6f
Compare
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
force-pushed
the
feat/EPINIO-790_unit_tests_shared_utils
branch
2 times, most recently
from
October 30, 2026 18:18
f291e6f to
b47e4e9
Compare
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.
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
Summary
Fixes EPINIO-790
Adds unit tests for the shared dashboard utils. These are pure helpers with no DOM or Vuex setup needed.
table-formatterswas the priority since every migrated table uses it.Occurred changes and/or fixed issues
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 helpersutils/permissions: role to permission mapping, including cluster-scoped actions being withheld from namespaced rolesutils/application: source type mapping, git URL parsing,sourceFingerprintutils/namespaces:useNamespacesagainst a mocked store (fetch, cache, search, seed, active namespace filter)utils/custom-routingandutils/embedded-helperspermissions,namespaces,application,custom-routingandembedded-helpersinto per-module folders with anindex.tsbarrel, matching thetable-formatterslayout (and trailhand-ui's). Importers are unchanged sinceutils/fooresolves to the folder's index.utils/applicationnow importsparsefrom the localutils/urlinstead of@shell/utils/url. The two implementations are identical.@types/jest,@types/nodeand@types/webpack-envas devDependencies and fixed thetypeslist inpkg/epinio/tsconfig.json. Before this,tscfailed on startup because of the missing type packages.Technical notes summary
@types/nodeis pinned to~20.10.0to match the existingresolutionsentry.nodeandwebpack-env, buttypeRootspoints atnode_modules, notnode_modules/@types, so those never resolved. They're now@types/webpack-envand@types/node.tsc --noEmit -p pkg/epinio/tsconfig.jsonnow runs clean (0 errors). It isn't wired into CI yet.isolatedModules, soyarn testdoesn't type-check. Usetscfor that.overrideTableRowPropdefines non-enumerable props, so the tests check them directly instead of withtoEqual.Areas or cases that should be tested
yarn testindashboard/: 116 passing.npx tsc --noEmit -p pkg/epinio/tsconfig.json: 0 errors.models/services.jsandmodels/catalogservices.jsimport through the@pkg/utils/custom-routingalias, which Jest doesn't exercise.getGitDataand its newutils/urlimport.Areas which could experience regressions
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.