mirror of
https://github.com/diegosouzapw/OmniRoute.git
synced 2026-09-13 18:32:12 +03:00
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!
19 lines
755 B
TypeScript
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");
|
|
});
|
|
});
|