Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

PR: Resolving testing library console errors #311

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions frontend/test/ParticipantList.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ describe("<ParticipantList />", () => {
</BrowserRouter>
)
const tableElement = getByLabelText(/table/i)
expect(tableElement).toBeInTheDOM()
expect(tableElement).toBeInTheDocument()
})

it("should render a ParticipantList component and have a bottom navigation", () => {
Expand All @@ -40,6 +40,6 @@ describe("<ParticipantList />", () => {
</BrowserRouter>
)
const bottomNavElement = getByLabelText(/bottomNav/i)
expect(bottomNavElement).toBeInTheDOM()
expect(bottomNavElement).toBeInTheDocument()
})
})
28 changes: 17 additions & 11 deletions frontend/test/PrevPointTableBody.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import { BrowserRouter } from "react-router-dom"

const mockParticipantsList = [
{
id: null,
id: "c4ca1",
first_name: "John",
last_name: "Doe",
last_four_ssn: 1234,
Expand All @@ -19,7 +19,7 @@ const mockParticipantsList = [
insurer: "",
},
{
id: null,
id: "c81e2",
first_name: "Jane",
last_name: "Doe",
last_four_ssn: 1234,
Expand All @@ -33,14 +33,23 @@ const mockParticipantsList = [
insurer: "",
},
]
const table = document.createElement("table")
let table
let tableContainer

describe("<PrevPointTableBody />", () => {
beforeEach(() => {
table = document.createElement("table")
tableContainer = {
container: document.body.appendChild(table),
}
})

it("should render a PrevPointTableBody component", () => {
render(
<BrowserRouter>
<PrevPointTableBody participants={mockParticipantsList} />
</BrowserRouter>
</BrowserRouter>,
tableContainer
)
})

Expand All @@ -49,7 +58,8 @@ describe("<PrevPointTableBody />", () => {
const { getByText } = render(
<BrowserRouter>
<PrevPointTableBody participants={[]} />
</BrowserRouter>
</BrowserRouter>,
tableContainer
)
const tableBodyError = getByText(errorMessage)
expect(tableBodyError).toBeInTheDocument()
Expand All @@ -61,9 +71,7 @@ describe("<PrevPointTableBody />", () => {
<BrowserRouter>
<PrevPointTableBody participants={mockParticipantsList} />
</BrowserRouter>,
{
container: document.body.appendChild(table),
}
tableContainer
)
const tableBodyElement = getByLabelText(/tbody/i)
expect(tableBodyElement).toBeInTheDocument()
Expand All @@ -74,9 +82,7 @@ describe("<PrevPointTableBody />", () => {
<BrowserRouter>
<PrevPointTableBody participants={mockParticipantsList} />
</BrowserRouter>,
{
container: document.body.appendChild(table),
}
tableContainer
)
const tableRows = getAllByLabelText("trow")
const tableCellList = getAllByLabelText("tcell")
Expand Down
15 changes: 10 additions & 5 deletions frontend/test/PrevPointTableHead.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,19 @@ import { render } from "@testing-library/react"
import React from "react"
import PrevPointTableHead from "./../src/components/ParticipantTableComponent/PrevPointTableHead"

const table = document.createElement("table")
const tableContainer = {
container: document.body.appendChild(table),
}
let table
let tableContainer

describe("<PrevPointTableHead />", () => {
beforeEach(() => {
table = document.createElement("table")
tableContainer = {
container: document.body.appendChild(table),
}
})

it("should render a PrevPointTableHead component", () => {
render(<PrevPointTableHead />)
render(<PrevPointTableHead />, tableContainer)
})

it("should render a PrevPointTableHead and have a TableHead element", () => {
Expand Down