Skip to content

Commit

Permalink
feat(CatalogTableDisplay.test.tsx) add tests
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
ktun95 committed Apr 1, 2024
1 parent aaf7e8c commit 347ff8b
Showing 1 changed file with 20 additions and 0 deletions.
20 changes: 20 additions & 0 deletions packages/ui-dsc/src/__tests__/CatalogTableDisplay.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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"

Expand Down Expand Up @@ -155,3 +158,20 @@ describe("CatalogTableHeader", () => {
expect(screen.getByRole("cell", { name: "Strain ID" })).toBeInTheDocument()
})
})

describe("PlasmidCatalogTableDisplay", () => {
const testCases = pipe(mockPlasmids, Amap(({name}) => name))

Check failure on line 163 in packages/ui-dsc/src/__tests__/CatalogTableDisplay.test.tsx

View workflow job for this annotation

GitHub Actions / ESLint Report Analysis

packages/ui-dsc/src/__tests__/CatalogTableDisplay.test.tsx#L163

[prettier/prettier] Replace `mockPlasmids,·Amap(({name})·=>·name)` with `⏎····mockPlasmids,⏎····Amap(({·name·})·=>·name),⏎··`
const mockPlasmidData = { listPlasmids: { plasmids: mockPlasmids } }

Check failure on line 164 in packages/ui-dsc/src/__tests__/CatalogTableDisplay.test.tsx

View workflow job for this annotation

GitHub Actions / ESLint Report Analysis

packages/ui-dsc/src/__tests__/CatalogTableDisplay.test.tsx#L164

[prettier/prettier] Delete `·`
test.each(testCases)("properly displays row with name of plasmid: %s", (a) => {

Check failure on line 165 in packages/ui-dsc/src/__tests__/CatalogTableDisplay.test.tsx

View workflow job for this annotation

GitHub Actions / ESLint Report Analysis

packages/ui-dsc/src/__tests__/CatalogTableDisplay.test.tsx#L165

[prettier/prettier] Replace `"properly·displays·row·with·name·of·plasmid:·%s",` with `⏎····"properly·displays·row·with·name·of·plasmid:·%s",⏎···`
render(

Check failure on line 166 in packages/ui-dsc/src/__tests__/CatalogTableDisplay.test.tsx

View workflow job for this annotation

GitHub Actions / ESLint Report Analysis

packages/ui-dsc/src/__tests__/CatalogTableDisplay.test.tsx#L166

[prettier/prettier] Insert `··`
<MemoryRouter>

Check failure on line 167 in packages/ui-dsc/src/__tests__/CatalogTableDisplay.test.tsx

View workflow job for this annotation

GitHub Actions / ESLint Report Analysis

packages/ui-dsc/src/__tests__/CatalogTableDisplay.test.tsx#L167

[prettier/prettier] Insert `··`
<PlasmidCatalogTableDisplay

Check failure on line 168 in packages/ui-dsc/src/__tests__/CatalogTableDisplay.test.tsx

View workflow job for this annotation

GitHub Actions / ESLint Report Analysis

packages/ui-dsc/src/__tests__/CatalogTableDisplay.test.tsx#L168

[prettier/prettier] Insert `··`
data={mockPlasmidData}

Check failure on line 169 in packages/ui-dsc/src/__tests__/CatalogTableDisplay.test.tsx

View workflow job for this annotation

GitHub Actions / ESLint Report Analysis

packages/ui-dsc/src/__tests__/CatalogTableDisplay.test.tsx#L169

[prettier/prettier] Replace `··········` with `············`
dataField="listPlasmids"

Check failure on line 170 in packages/ui-dsc/src/__tests__/CatalogTableDisplay.test.tsx

View workflow job for this annotation

GitHub Actions / ESLint Report Analysis

packages/ui-dsc/src/__tests__/CatalogTableDisplay.test.tsx#L170

[prettier/prettier] Insert `··`
target={{} as RefObject<HTMLTableRowElement>}

Check failure on line 171 in packages/ui-dsc/src/__tests__/CatalogTableDisplay.test.tsx

View workflow job for this annotation

GitHub Actions / ESLint Report Analysis

packages/ui-dsc/src/__tests__/CatalogTableDisplay.test.tsx#L171

[prettier/prettier] Insert `··`
/>
</MemoryRouter>

Check failure on line 173 in packages/ui-dsc/src/__tests__/CatalogTableDisplay.test.tsx

View workflow job for this annotation

GitHub Actions / ESLint Report Analysis

packages/ui-dsc/src/__tests__/CatalogTableDisplay.test.tsx#L173

[prettier/prettier] Replace `·······</MemoryRouter>` with `········</MemoryRouter>,`
)

Check failure on line 174 in packages/ui-dsc/src/__tests__/CatalogTableDisplay.test.tsx

View workflow job for this annotation

GitHub Actions / ESLint Report Analysis

packages/ui-dsc/src/__tests__/CatalogTableDisplay.test.tsx#L174

[prettier/prettier] Replace `···` with `······`
expect(screen.getByText(a)).toBeInTheDocument()

Check failure on line 175 in packages/ui-dsc/src/__tests__/CatalogTableDisplay.test.tsx

View workflow job for this annotation

GitHub Actions / ESLint Report Analysis

packages/ui-dsc/src/__tests__/CatalogTableDisplay.test.tsx#L175

[prettier/prettier] Insert `··`
})

Check failure on line 176 in packages/ui-dsc/src/__tests__/CatalogTableDisplay.test.tsx

View workflow job for this annotation

GitHub Actions / ESLint Report Analysis

packages/ui-dsc/src/__tests__/CatalogTableDisplay.test.tsx#L176

[prettier/prettier] Replace `}` with `··},⏎··`
})

0 comments on commit 347ff8b

Please sign in to comment.