From 347ff8b43f86032b33df7c648666d0e80874756f Mon Sep 17 00:00:00 2001 From: Kevin Tun Date: Mon, 1 Apr 2024 01:09:40 -0500 Subject: [PATCH] feat(CatalogTableDisplay.test.tsx) add tests Tests for PlasmidCatalogTableDisplay have been added to the test file. The tests render the PlasmidCatalogTableDisplay component with mock plasmid data and checks that the corresponding rows have been rendered with the plasmid name. --- .../__tests__/CatalogTableDisplay.test.tsx | 20 +++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/packages/ui-dsc/src/__tests__/CatalogTableDisplay.test.tsx b/packages/ui-dsc/src/__tests__/CatalogTableDisplay.test.tsx index b86ed28723..ce16f110a9 100644 --- a/packages/ui-dsc/src/__tests__/CatalogTableDisplay.test.tsx +++ b/packages/ui-dsc/src/__tests__/CatalogTableDisplay.test.tsx @@ -3,11 +3,14 @@ import { render, screen } from "@testing-library/react" import userEvent from "@testing-library/user-event" import { MemoryRouter, Routes, Route } from "react-router-dom" import { RefObject } from "react" +import { pipe } from "fp-ts/function" +import { map as Amap } from "fp-ts/Array" import { abbreviateStringToLength, cellFunction, CatalogRows, CatalogTableHeader, + PlasmidCatalogTableDisplay, } from "../catalog/CatalogTableDisplay" import { mockPlasmids } from "../mocks/mockPlasmids" @@ -155,3 +158,20 @@ describe("CatalogTableHeader", () => { expect(screen.getByRole("cell", { name: "Strain ID" })).toBeInTheDocument() }) }) + +describe("PlasmidCatalogTableDisplay", () => { + const testCases = pipe(mockPlasmids, Amap(({name}) => name)) + const mockPlasmidData = { listPlasmids: { plasmids: mockPlasmids } } + test.each(testCases)("properly displays row with name of plasmid: %s", (a) => { + render( + + } + /> + + ) + expect(screen.getByText(a)).toBeInTheDocument() + }) +})