CFE-26 correct the Delete Form in Role Management

This commit is contained in:
2023-10-21 10:17:41 +03:30
parent 64be82b292
commit d7b4018b41

View File

@@ -1,51 +1,51 @@
import {act, render, screen} from "@testing-library/react";
import {act, render, screen, waitFor} from "@testing-library/react";
import MockAppWithProviders from "../../../../../../../mocks/AppWithProvider";
import DeleteContent from "@/components/dashboard/role-management/Form/DeleteForm/DeleteContent";
import UpdateContent from "@/components/dashboard/role-management/Form/UpdateForm/UpdateContent";
describe("Create Content component from Create Form Component in Role Management Component",()=> {
describe("Create Content component from Create Form Component in Role Management Component", () => {
describe("Rendering", () => {
it('should see DeleteDialog text in the top ', async () => {
render(
<MockAppWithProviders>
<DeleteContent rowId={1}/>
<DeleteContent rowId = {1}/>
</MockAppWithProviders>
)
const textElement = screen.queryByText("حذف")
act(()=>{
await waitFor(() => {
expect(textElement).toBeInTheDocument()
})
})
it('should see DeleteDialog text content ', async () => {
render(
<MockAppWithProviders>
<DeleteContent rowId={1}/>
<DeleteContent rowId = {1}/>
</MockAppWithProviders>
)
const textElement = screen.queryByText("آیا از حدف این مورد اطمینان دارید ؟")
act(()=>{
await waitFor(() => {
expect(textElement).toBeInTheDocument()
})
})
it('should see delete text in the delete button ', () => {
it('should see delete text in the delete button ', async () => {
render(
<MockAppWithProviders>
<DeleteContent rowId={1}/>
<DeleteContent rowId = {1}/>
</MockAppWithProviders>
)
const buttonElement = screen.queryByText("حذف کردن")
act(()=>{
await waitFor(() => {
expect(buttonElement).toBeInTheDocument()
})
});
it('should see cancel text in the cancel button ', () => {
it('should see cancel text in the cancel button ', async () => {
render(
<MockAppWithProviders>
<DeleteContent rowId={1}/>
<DeleteContent rowId = {1}/>
</MockAppWithProviders>
)
const buttonElement = screen.queryByText("انصراف")
act(()=>{
await waitFor(() => {
expect(buttonElement).toBeInTheDocument()
})
});