test(client): stabilize UI regression tests

Replace brittle client snapshot coverage with explicit assertions so the updated test stack no longer depends on snapshot state initialization. Update the react-i18next mock to avoid mutating function component defaultProps while preserving WrappedComponent metadata for layout tests.
This commit is contained in:
Mrugesh Mohapatra
2026-04-20 10:01:26 +05:30
parent e88d5609e5
commit 983b249de0
17 changed files with 122 additions and 1538 deletions
+10 -2
View File
@@ -35,8 +35,16 @@ const renderNodes = reactNodes => {
};
const withTranslation = () => Component => {
Component.defaultProps = { ...Component.defaultProps, t: str => str };
return Component;
const WrappedComponent = props =>
React.createElement(Component, {
...props,
t: props.t ?? (str => str)
});
WrappedComponent.WrappedComponent = Component;
WrappedComponent.displayName = `withTranslation(${Component.displayName || Component.name || 'Component'})`;
return WrappedComponent;
};
const useTranslation = () => {