Skip to content

Commit cb546a2

Browse files
Add PlotTimeline.test.tsx
1 parent c4f62e7 commit cb546a2

File tree

1 file changed

+32
-0
lines changed

1 file changed

+32
-0
lines changed
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
import * as Optuna from "@optuna/types"
2+
import { render, screen } from "@testing-library/react"
3+
import React from "react"
4+
import { describe, expect, test } from "vitest"
5+
import { PlotTimeline } from "../src/components/PlotTimeline"
6+
7+
describe("PlotSlice Tests", async () => {
8+
const setup = ({
9+
study,
10+
dataTestId,
11+
}: { study: Optuna.Study; dataTestId: string }) => {
12+
const Wrapper = ({
13+
dataTestId,
14+
children,
15+
}: {
16+
dataTestId: string
17+
children: React.ReactNode
18+
}) => <div data-testid={dataTestId}>{children}</div>
19+
return render(
20+
<Wrapper dataTestId={dataTestId}>
21+
<PlotTimeline study={study} />
22+
</Wrapper>
23+
)
24+
}
25+
26+
for (const study of window.mockStudies) {
27+
test(`PlotSlice (study name: ${study.name})`, () => {
28+
setup({ study, dataTestId: `plot-slice-${study.id}` })
29+
expect(screen.getByTestId(`plot-slice-${study.id}`)).toBeInTheDocument()
30+
})
31+
}
32+
})

0 commit comments

Comments
 (0)