| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263 |
- /*
- Copyright (C) 2023 Cloudbase Solutions SRL
- This program is free software: you can redistribute it and/or modify
- it under the terms of the GNU Affero General Public License as
- published by the Free Software Foundation, either version 3 of the
- License, or (at your option) any later version.
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU Affero General Public License for more details.
- You should have received a copy of the GNU Affero General Public License
- along with this program. If not, see <http://www.gnu.org/licenses/>.
- */
- import React from "react";
- import { render } from "@testing-library/react";
- import TestUtils from "@tests/TestUtils";
- import DeleteTransferModal from "./DeleteTransferModal";
- describe("DeleteTransferModal", () => {
- let defaultProps: DeleteTransferModal["props"];
- beforeEach(() => {
- defaultProps = {
- hasDisks: false,
- onDeleteTransfer: jest.fn(),
- onDeleteDisks: jest.fn(),
- onRequestClose: jest.fn(),
- };
- });
- it("renders without crashing", () => {
- const { getByText } = render(<DeleteTransferModal {...defaultProps} />);
- expect(getByText("Delete Transfer")).toBeTruthy();
- });
- it("renders with disks", () => {
- render(<DeleteTransferModal {...defaultProps} hasDisks />);
- expect(
- TestUtils.select("DeleteTransferModal__ExtraMessage")?.textContent
- ).toContain("has been executed at least once");
- });
- it("is multiple replica selection with disks", () => {
- render(
- <DeleteTransferModal
- {...defaultProps}
- hasDisks
- isMultiTransferSelection
- />
- );
- expect(
- TestUtils.select("DeleteTransferModal__ExtraMessage")?.textContent
- ).toContain("have been executed at least once");
- });
- it("renders loading", () => {
- render(<DeleteTransferModal {...defaultProps} loading />);
- expect(TestUtils.select("DeleteTransferModal__Loading")).toBeTruthy();
- });
- });
|