import Wrapper from "@test/wrapper"; import { render, screen } from "@testing-library/react"; import React from "react"; import AppInProgressDeleteDialog from "./AppInProgressDeleteDialog"; import msgs from "./messages"; describe("Apps AppInProgressDeleteDialog", () => { it("displays action text with app name when app name passed", () => { // Arrange const name = "Test App"; render( , ); const dialogContent = screen.getByTestId("dialog-content"); // Assert const expectedText = msgs.deleteNamedApp.defaultMessage.replace( "{name}", name, ); expect(dialogContent).toHaveTextContent(expectedText); }); it("displays action text without app name when app name is empty", () => { // Arrange render( , ); const dialogContent = screen.getByTestId("dialog-content"); // Assert const expectedText = msgs.deleteApp.defaultMessage; expect(dialogContent).toHaveTextContent(expectedText); }); it("displays action text without app name when app name is null", () => { // Arrange render( , ); const dialogContent = screen.getByTestId("dialog-content"); // Assert const expectedText = msgs.deleteApp.defaultMessage; expect(dialogContent).toHaveTextContent(expectedText); }); });