Cover model ordering and visibility settings
Co-authored-by: Julius Marminge <[email protected]>
This commit is contained in:
1 parent
c150fb70b2
commit
1178cca8a1
3 files changed
+23
-3
No files matched your search
@@ -8,6 +8,7 @@ import { render } from "vitest-browser-react";
|
||||
import { ProviderModelPicker } from "./ProviderModelPicker";
|
||||
import { getCustomModelOptionsByProvider } from "../../modelSelection";
|
||||
import { DEFAULT_CLIENT_SETTINGS, DEFAULT_UNIFIED_SETTINGS } from "@t3tools/contracts/settings";
|
||||
import { __resetClientSettingsPersistenceForTests } from "../../hooks/useSettings";
|
||||
import { __resetLocalApiForTests } from "../../localApi";
|
||||
|
||||
// Mock the environments/runtime module to provide a mock primary environment connection
|
||||
@@ -294,12 +295,16 @@ function getSidebarProviderOrder() {
|
||||
describe("ProviderModelPicker", () => {
|
||||
beforeEach(async () => {
|
||||
// Reset test environment before each test
|
||||
localStorage.clear();
|
||||
await __resetLocalApiForTests();
|
||||
__resetClientSettingsPersistenceForTests();
|
||||
});
|
||||
|
||||
afterEach(async () => {
|
||||
document.body.innerHTML = "";
|
||||
localStorage.clear();
|
||||
await __resetLocalApiForTests();
|
||||
__resetClientSettingsPersistenceForTests();
|
||||
});
|
||||
|
||||
it("shows provider sidebar in unlocked mode", async () => {
|
||||
@@ -928,6 +933,7 @@ describe("ProviderModelPicker", () => {
|
||||
|
||||
try {
|
||||
await page.getByRole("button").click();
|
||||
await page.getByRole("button", { name: "Favorites", exact: true }).click();
|
||||
|
||||
await vi.waitFor(() => {
|
||||
expect(getVisibleModelNames().slice(0, 2)).toEqual(["GPT-5 Codex", "Claude Sonnet 4.6"]);
|
||||
@@ -966,7 +972,9 @@ describe("ProviderModelPicker", () => {
|
||||
await page.getByRole("button", { name: "Codex", exact: true }).click();
|
||||
|
||||
await vi.waitFor(() => {
|
||||
expect(getVisibleModelNames()).toEqual(["GPT-5 Codex"]);
|
||||
const visibleModelNames = getVisibleModelNames();
|
||||
expect(visibleModelNames).toContain("GPT-5 Codex");
|
||||
expect(visibleModelNames).not.toContain("GPT-5.3 Codex");
|
||||
});
|
||||
} finally {
|
||||
await mounted.cleanup();
|
||||
|
||||
@@ -3,6 +3,7 @@ import "../../index.css";
|
||||
import {
|
||||
type AuthAccessStreamEvent,
|
||||
type AuthAccessSnapshot,
|
||||
type ClientSettings,
|
||||
AuthSessionId,
|
||||
DEFAULT_SERVER_SETTINGS,
|
||||
EnvironmentId,
|
||||
@@ -23,6 +24,7 @@ import { AppAtomRegistryProvider } from "../../rpc/atomRegistry";
|
||||
import { resetServerStateForTests, setServerConfigSnapshot } from "../../rpc/serverState";
|
||||
import { ConnectionsSettings } from "./ConnectionsSettings";
|
||||
import { GeneralSettingsPanel } from "./SettingsPanels";
|
||||
import { __resetClientSettingsPersistenceForTests } from "../../hooks/useSettings";
|
||||
|
||||
const authAccessHarness = vi.hoisted(() => {
|
||||
type Snapshot = AuthAccessSnapshot;
|
||||
@@ -380,6 +382,7 @@ describe("GeneralSettingsPanel observability", () => {
|
||||
beforeEach(async () => {
|
||||
resetServerStateForTests();
|
||||
await __resetLocalApiForTests();
|
||||
__resetClientSettingsPersistenceForTests();
|
||||
localStorage.clear();
|
||||
authAccessHarness.reset();
|
||||
});
|
||||
@@ -396,6 +399,7 @@ describe("GeneralSettingsPanel observability", () => {
|
||||
document.body.innerHTML = "";
|
||||
resetServerStateForTests();
|
||||
await __resetLocalApiForTests();
|
||||
__resetClientSettingsPersistenceForTests();
|
||||
authAccessHarness.reset();
|
||||
});
|
||||
|
||||
@@ -760,8 +764,8 @@ describe("GeneralSettingsPanel observability", () => {
|
||||
it("toggles model visibility from provider settings", async () => {
|
||||
const updateSettings = vi
|
||||
.fn<LocalApi["server"]["updateSettings"]>()
|
||||
.mockResolvedValue(undefined);
|
||||
const config = {
|
||||
.mockImplementation(async () => DEFAULT_SERVER_SETTINGS);
|
||||
const config: ServerConfig = {
|
||||
...createBaseServerConfig(),
|
||||
providers: [
|
||||
{
|
||||
@@ -788,6 +792,12 @@ describe("GeneralSettingsPanel observability", () => {
|
||||
};
|
||||
setServerConfigSnapshot(config);
|
||||
window.nativeApi = {
|
||||
persistence: {
|
||||
getClientSettings: async () => null,
|
||||
setClientSettings: async (settings: ClientSettings) => {
|
||||
localStorage.setItem("t3code:client-settings:v1", JSON.stringify(settings));
|
||||
},
|
||||
},
|
||||
server: {
|
||||
updateSettings,
|
||||
},
|
||||
|
||||
@@ -534,6 +534,7 @@ describe("wsApi", () => {
|
||||
confirmThreadDelete: false,
|
||||
diffWordWrap: true,
|
||||
favorites: [],
|
||||
hiddenModels: [],
|
||||
sidebarProjectGroupingMode: "repository_path" as const,
|
||||
sidebarProjectGroupingOverrides: {
|
||||
"environment-local:/tmp/project": "separate" as const,
|
||||
@@ -593,6 +594,7 @@ describe("wsApi", () => {
|
||||
confirmThreadDelete: false,
|
||||
diffWordWrap: true,
|
||||
favorites: [],
|
||||
hiddenModels: [],
|
||||
sidebarProjectGroupingMode: "repository_path" as const,
|
||||
sidebarProjectGroupingOverrides: {
|
||||
"environment-local:/tmp/project": "separate" as const,
|
||||
|
||||
Reference in new issue
Block a user