diff --git a/frontend/test/ParticipantList.test.js b/frontend/test/ParticipantList.test.js index 2e25ab8f..4d48649f 100644 --- a/frontend/test/ParticipantList.test.js +++ b/frontend/test/ParticipantList.test.js @@ -30,7 +30,7 @@ describe("", () => { ) const tableElement = getByLabelText(/table/i) - expect(tableElement).toBeInTheDOM() + expect(tableElement).toBeInTheDocument() }) it("should render a ParticipantList component and have a bottom navigation", () => { @@ -40,6 +40,6 @@ describe("", () => { ) const bottomNavElement = getByLabelText(/bottomNav/i) - expect(bottomNavElement).toBeInTheDOM() + expect(bottomNavElement).toBeInTheDocument() }) }) diff --git a/frontend/test/PrevPointTableBody.test.js b/frontend/test/PrevPointTableBody.test.js index 04fe6af3..83c3b53e 100644 --- a/frontend/test/PrevPointTableBody.test.js +++ b/frontend/test/PrevPointTableBody.test.js @@ -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, @@ -19,7 +19,7 @@ const mockParticipantsList = [ insurer: "", }, { - id: null, + id: "c81e2", first_name: "Jane", last_name: "Doe", last_four_ssn: 1234, @@ -33,14 +33,23 @@ const mockParticipantsList = [ insurer: "", }, ] -const table = document.createElement("table") +let table +let tableContainer describe("", () => { + beforeEach(() => { + table = document.createElement("table") + tableContainer = { + container: document.body.appendChild(table), + } + }) + it("should render a PrevPointTableBody component", () => { render( - + , + tableContainer ) }) @@ -49,7 +58,8 @@ describe("", () => { const { getByText } = render( - + , + tableContainer ) const tableBodyError = getByText(errorMessage) expect(tableBodyError).toBeInTheDocument() @@ -61,9 +71,7 @@ describe("", () => { , - { - container: document.body.appendChild(table), - } + tableContainer ) const tableBodyElement = getByLabelText(/tbody/i) expect(tableBodyElement).toBeInTheDocument() @@ -74,9 +82,7 @@ describe("", () => { , - { - container: document.body.appendChild(table), - } + tableContainer ) const tableRows = getAllByLabelText("trow") const tableCellList = getAllByLabelText("tcell") diff --git a/frontend/test/PrevPointTableHead.test.js b/frontend/test/PrevPointTableHead.test.js index 82046fea..40f87a43 100644 --- a/frontend/test/PrevPointTableHead.test.js +++ b/frontend/test/PrevPointTableHead.test.js @@ -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("", () => { + beforeEach(() => { + table = document.createElement("table") + tableContainer = { + container: document.body.appendChild(table), + } + }) + it("should render a PrevPointTableHead component", () => { - render() + render(, tableContainer) }) it("should render a PrevPointTableHead and have a TableHead element", () => {