mirror of
https://github.com/wassname/optuna-dashboard.git
synced 2026-09-11 12:30:25 +08:00
Add test for PlotSlice
This commit is contained in:
@@ -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()
|
||||
})
|
||||
}
|
||||
})
|
||||
Reference in New Issue
Block a user