Skip to content

Commit

Permalink
Add test for PlotSlice
Browse files Browse the repository at this point in the history
  • Loading branch information
porink0424 committed Jun 21, 2024
1 parent 0947d8b commit 0c1f9c7
Showing 1 changed file with 32 additions and 0 deletions.
32 changes: 32 additions & 0 deletions tslib/react/test/PlotSlice.test.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
import * as Optuna from "@optuna/types"
import { render, screen } from "@testing-library/react"
import React from "react"
import { describe, expect, test } from "vitest"
import { PlotSlice } from "../src/components/PlotSlice"

describe("PlotSlice Tests", async () => {
const setup = ({
study,
dataTestId,
}: { study: Optuna.Study; dataTestId: string }) => {
const Wrapper = ({
dataTestId,
children,
}: {
dataTestId: string
children: React.ReactNode
}) => <div data-testid={dataTestId}>{children}</div>
return render(
<Wrapper dataTestId={dataTestId}>
<PlotSlice study={study} />
</Wrapper>
)
}

for (const study of window.mockStudies) {
test(`PlotSlice (study name: ${study.name})`, () => {
setup({ study, dataTestId: `plot-slice-${study.id}` })
expect(screen.getByTestId(`plot-slice-${study.id}`)).toBeInTheDocument()
})
}
})

0 comments on commit 0c1f9c7

Please sign in to comment.