mirror of
https://github.com/wassname/optuna-dashboard.git
synced 2026-09-09 11:28:14 +08:00
fix test and sortable
This commit is contained in:
@@ -604,13 +604,14 @@ export const TrialTable: FC<{ studyDetail: StudyDetail | null }> = ({
|
||||
studyDetail?.intersection_search_space.length
|
||||
) {
|
||||
studyDetail?.intersection_search_space.forEach((s) => {
|
||||
const sortable = s.distribution !== "CategoricalDistribution"
|
||||
columns.push({
|
||||
field: "params",
|
||||
label: `Param ${s.name}`,
|
||||
toCellValue: (i) =>
|
||||
trials[i].params.find((p) => p.name === s.name)?.value || null,
|
||||
sortable: true,
|
||||
filterable: false,
|
||||
sortable: sortable,
|
||||
filterable: false, // TODO(yoshinobc): Support filtering by categorical parameters
|
||||
less: (firstEl, secondEl): number => {
|
||||
const firstVal = firstEl.params.find((p) => p.name === s.name)?.value
|
||||
const secondVal = secondEl.params.find(
|
||||
|
||||
@@ -86,13 +86,14 @@ it("Sort TrialTable by trial number", () => {
|
||||
<TrialTable studyDetail={studyDetail} />
|
||||
)
|
||||
const rows = getAllByRole("row")
|
||||
|
||||
expect(within(rows[1]).getByText("0")).toBeTruthy()
|
||||
expect(within(rows[3]).getByText("1")).toBeTruthy()
|
||||
expect(within(rows[3]).getAllByText("1")[0]).toBeTruthy()
|
||||
|
||||
fireEvent.click(getByText("Number"))
|
||||
|
||||
const rows_updated = getAllByRole("row")
|
||||
expect(within(rows_updated[1]).getByText("1")).toBeTruthy()
|
||||
expect(within(rows_updated[1]).getAllByText("1")[0]).toBeTruthy()
|
||||
expect(within(rows_updated[3]).getByText("0")).toBeTruthy()
|
||||
})
|
||||
|
||||
|
||||
Reference in New Issue
Block a user