Added comprehensive unit test coverage for Container Copy jobs (#2275)

* copy job uts

* unit test coverage

* lint fix

* normalize account dropdown id
This commit is contained in:
BChoudhury-ms
2025-12-09 09:35:58 +05:30
committed by GitHub
parent ca858c08fb
commit a714ef02c0
80 changed files with 23899 additions and 35 deletions

View File

@@ -0,0 +1,52 @@
import { render } from "@testing-library/react";
import React from "react";
import LoadingOverlay from "./LoadingOverlay";
describe("LoadingOverlay", () => {
const defaultProps = {
isLoading: true,
label: "Loading...",
};
it("should render loading overlay when isLoading is true", () => {
const { container } = render(<LoadingOverlay {...defaultProps} />);
expect(container.firstChild).toMatchSnapshot();
});
it("should render loading overlay with custom label", () => {
const customProps = {
isLoading: true,
label: "Processing your request...",
};
const { container } = render(<LoadingOverlay {...customProps} />);
expect(container.firstChild).toMatchSnapshot();
});
it("should render loading overlay with empty label", () => {
const emptyLabelProps = {
isLoading: true,
label: "",
};
const { container } = render(<LoadingOverlay {...emptyLabelProps} />);
expect(container.firstChild).toMatchSnapshot();
});
it("should return null when isLoading is false", () => {
const notLoadingProps = {
isLoading: false,
label: "Loading...",
};
const { container } = render(<LoadingOverlay {...notLoadingProps} />);
expect(container.firstChild).toBeNull();
});
it("should handle long labels properly", () => {
const longLabelProps = {
isLoading: true,
label:
"This is a very long loading message that might span multiple lines and should still render correctly in the loading overlay component",
};
const { container } = render(<LoadingOverlay {...longLabelProps} />);
expect(container.firstChild).toMatchSnapshot();
});
});

View File

@@ -0,0 +1,73 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP
exports[`LoadingOverlay should handle long labels properly 1`] = `
<div
class="ms-Overlay root-109"
>
<div
class="ms-Spinner root-111"
>
<div
class="ms-Spinner-circle ms-Spinner--large circle-112"
/>
<div
class="ms-Spinner-label label-113"
>
This is a very long loading message that might span multiple lines and should still render correctly in the loading overlay component
</div>
</div>
</div>
`;
exports[`LoadingOverlay should render loading overlay when isLoading is true 1`] = `
<div
class="ms-Overlay root-109"
>
<div
class="ms-Spinner root-111"
>
<div
class="ms-Spinner-circle ms-Spinner--large circle-112"
/>
<div
class="ms-Spinner-label label-113"
>
Loading...
</div>
</div>
</div>
`;
exports[`LoadingOverlay should render loading overlay with custom label 1`] = `
<div
class="ms-Overlay root-109"
>
<div
class="ms-Spinner root-111"
>
<div
class="ms-Spinner-circle ms-Spinner--large circle-112"
/>
<div
class="ms-Spinner-label label-113"
>
Processing your request...
</div>
</div>
</div>
`;
exports[`LoadingOverlay should render loading overlay with empty label 1`] = `
<div
class="ms-Overlay root-109"
>
<div
class="ms-Spinner root-111"
>
<div
class="ms-Spinner-circle ms-Spinner--large circle-112"
/>
</div>
</div>
`;