mirror of
https://github.com/Azure/cosmos-explorer.git
synced 2026-01-22 03:04:07 +00:00
Compare commits
2 Commits
copilot/su
...
user/bchou
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
f894c6c0fb | ||
|
|
6dce2632c8 |
@@ -1,6 +1,6 @@
|
||||
import React, { useEffect } from "react";
|
||||
import { Dialog } from "../Controls/Dialog";
|
||||
import { SidePanel } from "../Panes/PanelContainerComponent";
|
||||
import { Dialog } from "../../Explorer/Controls/Dialog";
|
||||
import { SidePanel } from "../../Explorer/Panes/PanelContainerComponent";
|
||||
import CopyJobCommandBar from "./CommandBar/CopyJobCommandBar";
|
||||
import "./containerCopyStyles.less";
|
||||
import { MonitorCopyJobsRefState } from "./MonitorCopyJobs/MonitorCopyJobRefState";
|
||||
|
||||
@@ -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 * as StyleConstants from "../Common/StyleConstants";
|
||||
import { updateStyles } from "../Common/StyleConstants";
|
||||
import { Platform } from "../ConfigContext";
|
||||
import { useConfig } from "../hooks/useConfig";
|
||||
import { useKnockoutExplorer } from "../hooks/useKnockoutExplorer";
|
||||
@@ -150,13 +150,15 @@ 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(StyleConstants.updateStyles);
|
||||
mockUpdateStyles = jest.mocked(updateStyles);
|
||||
|
||||
const mockUseMetricScenario = jest.mocked(useMetricScenario);
|
||||
mockUseMetricScenario.mockReturnValue({
|
||||
|
||||
@@ -40,9 +40,12 @@ const App = (): JSX.Element => {
|
||||
// Scenario-based health tracking: start ApplicationLoad and complete phases.
|
||||
const { startScenario, completePhase } = useMetricScenario();
|
||||
React.useEffect(() => {
|
||||
startScenario(MetricScenario.ApplicationLoad);
|
||||
// eslint-disable-next-line react-hooks/exhaustive-deps
|
||||
}, []);
|
||||
// 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]);
|
||||
|
||||
React.useEffect(() => {
|
||||
if (explorer) {
|
||||
|
||||
@@ -88,6 +88,19 @@ 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();
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user