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:
@@ -7949,6 +7949,8 @@ __metadata:
|
||||
"@remixicon/react": "npm:^4.6.0"
|
||||
"@storybook/react-vite": "npm:^10.3.3"
|
||||
"@tanstack/react-table": "npm:^8.21.3"
|
||||
"@testing-library/jest-dom": "npm:^6.0.0"
|
||||
"@testing-library/react": "npm:^16.0.0"
|
||||
"@types/react": "npm:^18.0.0"
|
||||
"@types/react-dom": "npm:^18.0.0"
|
||||
"@types/use-sync-external-store": "npm:^1.0.0"
|
||||
|
||||
Reference in New Issue
Block a user