Compare commits

..

5 Commits

Author SHA1 Message Date
copilot-swe-agent[bot]
cc3030787c Fix test import inconsistency to match actual usage pattern
Co-authored-by: BChoudhury-ms <201893606+BChoudhury-ms@users.noreply.github.com>
2026-01-21 10:41:17 +00:00
copilot-swe-agent[bot]
812b836c14 Initial plan 2026-01-21 10:36:24 +00:00
Copilot
8dcfb8d062 Remove redundant test cases in Root.test.tsx (#2333)
* Initial plan

* Remove redundant test cases from Root.test.tsx

Co-authored-by: BChoudhury-ms <201893606+BChoudhury-ms@users.noreply.github.com>

---------

Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: BChoudhury-ms <201893606+BChoudhury-ms@users.noreply.github.com>
2026-01-21 16:00:09 +05:30
BChoudhury-ms
011f3cee59 Apply suggestions from code review
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
2026-01-21 16:00:09 +05:30
Bikram Choudhury
da2a2a51ea Refactor: Extract root components architecture with comprehensive tests 2026-01-21 16:00:09 +05:30
4 changed files with 7 additions and 25 deletions

View File

@@ -1,6 +1,6 @@
import React, { useEffect } from "react";
import { Dialog } from "../../Explorer/Controls/Dialog";
import { SidePanel } from "../../Explorer/Panes/PanelContainerComponent";
import { Dialog } from "../Controls/Dialog";
import { SidePanel } from "../Panes/PanelContainerComponent";
import CopyJobCommandBar from "./CommandBar/CopyJobCommandBar";
import "./containerCopyStyles.less";
import { MonitorCopyJobsRefState } from "./MonitorCopyJobs/MonitorCopyJobRefState";

View File

@@ -2,7 +2,7 @@ import { loadTheme } from "@fluentui/react";
import "@testing-library/jest-dom";
import { render, screen, waitFor } from "@testing-library/react";
import React from "react";
import { updateStyles } from "../Common/StyleConstants";
import * as StyleConstants from "../Common/StyleConstants";
import { Platform } from "../ConfigContext";
import { useConfig } from "../hooks/useConfig";
import { useKnockoutExplorer } from "../hooks/useKnockoutExplorer";
@@ -150,15 +150,13 @@ describe("App", () => {
let mockUpdateStyles: jest.Mock;
beforeEach(() => {
jest.clearAllMocks();
mockStartScenario = jest.fn();
mockCompletePhase = jest.fn();
mockUseKnockoutExplorer = jest.mocked(useKnockoutExplorer);
mockUseConfig = jest.mocked(useConfig);
mockLoadTheme = jest.mocked(loadTheme);
mockUpdateStyles = jest.mocked(updateStyles);
mockUpdateStyles = jest.mocked(StyleConstants.updateStyles);
const mockUseMetricScenario = jest.mocked(useMetricScenario);
mockUseMetricScenario.mockReturnValue({

View File

@@ -40,12 +40,9 @@ const App = (): JSX.Element => {
// Scenario-based health tracking: start ApplicationLoad and complete phases.
const { startScenario, completePhase } = useMetricScenario();
React.useEffect(() => {
// Only start scenario after config is initialized to avoid race conditions
// with message handlers that depend on configContext.platform
if (config) {
startScenario(MetricScenario.ApplicationLoad);
}
}, [config, startScenario]);
startScenario(MetricScenario.ApplicationLoad);
// eslint-disable-next-line react-hooks/exhaustive-deps
}, []);
React.useEffect(() => {
if (explorer) {

View File

@@ -88,19 +88,6 @@ describe("Root", () => {
expect(mockUnsubscribe).toHaveBeenCalled();
});
test("should call getState to initialize theme", () => {
render(<Root />);
expect(mockThemeStore.getState).toHaveBeenCalledTimes(1);
});
test("should handle theme subscription properly", () => {
render(<Root />);
expect(mockThemeStore.subscribe).toHaveBeenCalledTimes(1);
expect(mockThemeStore.getState).toHaveBeenCalled();
});
test("should render without errors", () => {
expect(() => render(<Root />)).not.toThrow();
});