Skip to content

Commit

Permalink
Remove acts
Browse files Browse the repository at this point in the history
  • Loading branch information
edlouth committed Aug 22, 2023
1 parent d713004 commit 7c2fef7
Showing 1 changed file with 6 additions and 19 deletions.
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import userEvent from "@testing-library/user-event"
import { GraphQLError } from "graphql"
import { act } from "react-dom/test-utils"
import { render, screen, waitFor } from "testing"
import GraphFilterInline, { GET_WORKSPACE } from "./GraphFilterInline"

Expand Down Expand Up @@ -68,17 +67,13 @@ test("add", async () => {
expect(screen.getByTestId("AddIcon")).toBeInTheDocument()
})

await act(async () => {
await userEvent.click(screen.getByTestId("AddIcon"))
})
await userEvent.click(screen.getByTestId("AddIcon"))

await waitFor(() => {
expect(screen.getByText("Choose data field to add")).toBeInTheDocument()
})

await act(async () => {
await userEvent.click(screen.getByRole("option", { name: /tag/i }))
})
await userEvent.click(screen.getByRole("option", { name: /tag/i }))

expect(setInlineFilters).toHaveBeenCalledWith([
{ field: "namespace", operator: "equals", type: "table", value: "test" },
Expand All @@ -96,17 +91,13 @@ test("remove", async () => {
expect(screen.getByText("Namespace")).toBeInTheDocument()
})

await act(async () => {
await userEvent.hover(screen.getByText("Namespace"))
})
await userEvent.hover(screen.getByText("Namespace"))

await waitFor(() => {
expect(screen.getByTestId("DeleteIcon")).toBeInTheDocument()
})

await act(async () => {
await userEvent.click(screen.getByTestId("DeleteIcon"))
})
await userEvent.click(screen.getByTestId("DeleteIcon"))

expect(setInlineFilters).toHaveBeenCalledWith([])
})
Expand All @@ -122,9 +113,7 @@ test("edit", async () => {
expect(screen.getByText("Namespace")).toBeInTheDocument()
})

await act(async () => {
await userEvent.click(screen.getByText("Namespace"))
})
await userEvent.click(screen.getByText("Namespace"))

await waitFor(() => {
expect(
Expand All @@ -136,9 +125,7 @@ test("edit", async () => {
expect(screen.getByText("In")).toBeInTheDocument()
})

await act(async () => {
await userEvent.click(screen.getByText("In"))
})
await userEvent.click(screen.getByText("In"))

expect(setInlineFilters).toHaveBeenCalledWith([
{
Expand Down

0 comments on commit 7c2fef7

Please sign in to comment.