Files
OmniRoute/tests/unit/dashboard/ComboSortSelect.test.tsx
Dizzle d5dfcfff58 feat(combo): choose sort method for combo models (manual/provider/score/name) (#11812)
Lets the combo dashboard builder order models manually/by-provider/by-score/by-name — the choice is stored in config.modelSort and re-applied on load and after adding models. Score-based ordering fetches provider rankings from the existing /api/free-provider-rankings endpoint; the field is inert on execution (client-side hint only). 9/9 focused tests passing (schema, sort logic, and rendered component). Thanks!
2026-08-28 12:37:58 -03:00

19 lines
755 B
TypeScript

import "../../_setup/jsdomGlobal.ts";
import { describe, it } from "node:test";
import assert from "node:assert/strict";
import { render, screen, fireEvent } from "@testing-library/react";
import { ComboSortSelect } from "@/app/(dashboard)/dashboard/combos/ComboSortSelect";
const t = (_k: string, f: string) => f;
describe("ComboSortSelect", () => {
it("renders four options and emits the chosen method", () => {
let chosen = "";
render(<ComboSortSelect value="manual" onChange={(mm) => (chosen = mm)} t={t} />);
const select = screen.getByRole("combobox");
assert.equal((select as HTMLSelectElement).options.length, 4);
fireEvent.change(select, { target: { value: "provider" } });
assert.equal(chosen, "provider");
});
});