diff --git a/app/react/components/Widget/WidgetTabs.tsx b/app/react/components/Widget/WidgetTabs.tsx
index a01fb1753..3ff0a08b5 100644
--- a/app/react/components/Widget/WidgetTabs.tsx
+++ b/app/react/components/Widget/WidgetTabs.tsx
@@ -74,8 +74,8 @@ export function findSelectedTabIndex(
}
export function useCurrentTabIndex(tabs: Tab[]) {
- const prarms = useCurrentStateAndParams();
- const currentTabIndex = findSelectedTabIndex(prarms, tabs);
+ const params = useCurrentStateAndParams();
+ const currentTabIndex = findSelectedTabIndex(params, tabs);
- return [currentTabIndex];
+ return currentTabIndex;
}
diff --git a/app/react/kubernetes/cluster/NodeView/NodeView.test.tsx b/app/react/kubernetes/cluster/NodeView/NodeView.test.tsx
new file mode 100644
index 000000000..a3f3ad880
--- /dev/null
+++ b/app/react/kubernetes/cluster/NodeView/NodeView.test.tsx
@@ -0,0 +1,119 @@
+import { render, screen } from '@testing-library/react';
+import { vi } from 'vitest';
+import { ReactNode } from 'react';
+
+import { withTestRouter } from '@/react/test-utils/withRouter';
+import { withTestQueryProvider } from '@/react/test-utils/withTestQuery';
+import { withUserProvider } from '@/react/test-utils/withUserProvider';
+import { UserViewModel } from '@/portainer/models/user';
+
+import { NodeView } from './NodeView';
+
+let mockParams: { endpointId: number; nodeName: string; tab?: string } = {
+ endpointId: 1,
+ nodeName: 'test-node',
+};
+
+// Mock Link component to avoid ui-router relative state resolution in tests
+vi.mock('@@/Link', () => ({
+ Link: ({
+ children,
+ 'data-cy': dataCy,
+ params,
+ ...props
+ }: {
+ children: ReactNode;
+ 'data-cy'?: string;
+ params?: { tab?: string };
+ }) => (
+ {
+ if (params?.tab) {
+ // eslint-disable-next-line @typescript-eslint/no-use-before-define
+ mockParams = { ...mockParams, tab: params.tab };
+ }
+ }}
+ {...props}
+ >
+ {children}
+
+ ),
+}));
+
+vi.mock('@uirouter/react', async (importOriginal: () => Promise