Add test suite for useDefinition hook in @backstage/ui (#34042)
* Add test infrastructure to @backstage/ui Signed-off-by: Johan Persson <johanopersson@gmail.com> * Add resolveResponsiveValue tests Signed-off-by: Johan Persson <johanopersson@gmail.com> * Add useDefinition prop resolution and classes tests Fixed a bug in useDefinition where passing null for classNameTarget or utilityTarget was incorrectly defaulted to 'root' due to the nullish coalescing operator treating null as falsy. Signed-off-by: Johan Persson <johanopersson@gmail.com> * Add useDefinition data attributes tests Signed-off-by: Johan Persson <johanopersson@gmail.com> * Add resolveDefinitionProps tests Signed-off-by: Johan Persson <johanopersson@gmail.com> * Add processUtilityProps tests Signed-off-by: Johan Persson <johanopersson@gmail.com> * Add useDefinition bg system tests Signed-off-by: Johan Persson <johanopersson@gmail.com> * Add useDefinition utility style and analytics tests Signed-off-by: Johan Persson <johanopersson@gmail.com> * Add useDefinition href resolution tests Signed-off-by: Johan Persson <johanopersson@gmail.com> * Add useDefinition options tests Signed-off-by: Johan Persson <johanopersson@gmail.com> * Wrap all useDefinition tests with BUIProvider Signed-off-by: Johan Persson <johanopersson@gmail.com> * Fix type errors in useDefinition tests Use `as const satisfies ComponentConfig<any, any>` instead of `as ComponentConfig<any, any>` to preserve literal types needed by the conditional type machinery (DataAttributes, ResolveBgProps, analytics intersection). Signed-off-by: Johan Persson <johanopersson@gmail.com> * Address review feedback in useDefinition tests - Rename shadowed Wrapper to RouterWrapper in createRouterWrapper - Fix inaccurate comment about splat vs non-splat routes - Clarify misleading test name for provider data-bg behavior Signed-off-by: Johan Persson <johanopersson@gmail.com> --------- Signed-off-by: Johan Persson <johanopersson@gmail.com>
This commit is contained in:
@@ -59,6 +59,8 @@
|
||||
"devDependencies": {
|
||||
"@backstage/cli": "workspace:^",
|
||||
"@storybook/react-vite": "^10.3.3",
|
||||
"@testing-library/jest-dom": "^6.0.0",
|
||||
"@testing-library/react": "^16.0.0",
|
||||
"@types/react": "^18.0.0",
|
||||
"@types/react-dom": "^18.0.0",
|
||||
"@types/use-sync-external-store": "^1.0.0",
|
||||
|
||||
Reference in New Issue
Block a user