mirror of
https://github.com/Azure/cosmos-explorer.git
synced 2026-01-03 16:22:20 +00:00
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:
52
src/Common/LoadingOverlay.test.tsx
Normal file
52
src/Common/LoadingOverlay.test.tsx
Normal 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();
|
||||
});
|
||||
});
|
||||
73
src/Common/__snapshots__/LoadingOverlay.test.tsx.snap
Normal file
73
src/Common/__snapshots__/LoadingOverlay.test.tsx.snap
Normal 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>
|
||||
`;
|
||||
Reference in New Issue
Block a user