mirror of
https://github.com/Azure/cosmos-explorer.git
synced 2026-01-22 11:14:05 +00:00
Refactor Container Copy dropdowns with integrated state management (#2279)
This commit is contained in:
@@ -52,7 +52,7 @@ describe("CopyJobStatusWithIcon", () => {
|
||||
|
||||
const spinner = container.querySelector('[class*="ms-Spinner"]');
|
||||
expect(spinner).toBeInTheDocument();
|
||||
expect(container).toHaveTextContent("In Progress");
|
||||
expect(container).toHaveTextContent("Running");
|
||||
expect(container.firstChild).toMatchSnapshot();
|
||||
});
|
||||
});
|
||||
@@ -83,18 +83,18 @@ describe("CopyJobStatusWithIcon", () => {
|
||||
it("provides meaningful text content for screen readers", () => {
|
||||
const { container } = render(<CopyJobStatusWithIcon status={CopyJobStatusType.InProgress} />);
|
||||
|
||||
expect(container).toHaveTextContent("In Progress");
|
||||
expect(container).toHaveTextContent("Running");
|
||||
});
|
||||
});
|
||||
|
||||
describe("Icon and Status Mapping", () => {
|
||||
it("renders correct status text based on mapping", () => {
|
||||
const statusMappings = [
|
||||
{ status: CopyJobStatusType.Pending, expectedText: "Pending" },
|
||||
{ status: CopyJobStatusType.Pending, expectedText: "Queued" },
|
||||
{ status: CopyJobStatusType.Paused, expectedText: "Paused" },
|
||||
{ status: CopyJobStatusType.Failed, expectedText: "Failed" },
|
||||
{ status: CopyJobStatusType.Completed, expectedText: "Completed" },
|
||||
{ status: CopyJobStatusType.Running, expectedText: "In Progress" },
|
||||
{ status: CopyJobStatusType.Running, expectedText: "Running" },
|
||||
];
|
||||
|
||||
statusMappings.forEach(({ status, expectedText }) => {
|
||||
|
||||
@@ -15,7 +15,7 @@ exports[`CopyJobStatusWithIcon Spinner Status Types renders InProgress with spin
|
||||
<span
|
||||
class="css-112"
|
||||
>
|
||||
In Progress
|
||||
Running
|
||||
</span>
|
||||
</div>
|
||||
`;
|
||||
@@ -35,7 +35,7 @@ exports[`CopyJobStatusWithIcon Spinner Status Types renders Partitioning with sp
|
||||
<span
|
||||
class="css-112"
|
||||
>
|
||||
In Progress
|
||||
Running
|
||||
</span>
|
||||
</div>
|
||||
`;
|
||||
@@ -55,7 +55,7 @@ exports[`CopyJobStatusWithIcon Spinner Status Types renders Running with spinner
|
||||
<span
|
||||
class="css-112"
|
||||
>
|
||||
In Progress
|
||||
Running
|
||||
</span>
|
||||
</div>
|
||||
`;
|
||||
@@ -181,7 +181,7 @@ exports[`CopyJobStatusWithIcon Static Icon Status Types - Snapshot Tests renders
|
||||
<span
|
||||
class="css-112"
|
||||
>
|
||||
Pending
|
||||
Queued
|
||||
</span>
|
||||
</div>
|
||||
`;
|
||||
|
||||
@@ -44,7 +44,9 @@ const MonitorCopyJobs = forwardRef<MonitorCopyJobsRef, MonitorCopyJobsProps>(({
|
||||
return isEqual(prevJobs, normalizedResponse) ? prevJobs : normalizedResponse;
|
||||
});
|
||||
} catch (error) {
|
||||
setError(error.message || "Failed to load copy jobs. Please try again later.");
|
||||
if (error.message !== "Previous copy job request was cancelled.") {
|
||||
setError(error.message || "Failed to load copy jobs. Please try again later.");
|
||||
}
|
||||
} finally {
|
||||
if (isFirstFetchRef.current) {
|
||||
setLoading(false);
|
||||
|
||||
Reference in New Issue
Block a user