Skip to content

Commit 42a1d35

Browse files
test(web): keep provider field readers private
1 parent e5a87e8 commit 42a1d35

2 files changed

Lines changed: 2 additions & 20 deletions

File tree

‎apps/web/src/components/settings/ProviderSettingsForm.test.ts‎

Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,6 @@ import { DRIVER_OPTION_BY_VALUE } from "./providerDriverMeta";
55
import {
66
deriveProviderSettingsFields,
77
nextProviderConfigWithFieldValue,
8-
readProviderConfigBoolean,
9-
readProviderConfigString,
108
} from "./ProviderSettingsForm";
119

1210
describe("ProviderSettingsForm helpers", () => {
@@ -90,10 +88,6 @@ describe("ProviderSettingsForm helpers", () => {
9088
expect(next).toEqual({ forkOwned: 1 });
9189
});
9290

93-
it("reads non-string config values as blank strings", () => {
94-
expect(readProviderConfigString({ binaryPath: 123 }, "binaryPath")).toBe("");
95-
});
96-
9791
it("omits false boolean fields when clearWhenEmpty is omit", () => {
9892
const next = nextProviderConfigWithFieldValue(
9993
{ forkOwned: 1, experimental: true },
@@ -156,12 +150,4 @@ describe("ProviderSettingsForm helpers", () => {
156150

157151
expect(next).toEqual({ experimental: false });
158152
});
159-
160-
it("reads non-boolean config values as false booleans", () => {
161-
expect(readProviderConfigBoolean({ experimental: "true" }, "experimental")).toBe(false);
162-
});
163-
164-
it("reads missing boolean config values from the supplied default", () => {
165-
expect(readProviderConfigBoolean({}, "experimental", true)).toBe(true);
166-
});
167153
});

‎apps/web/src/components/settings/ProviderSettingsForm.tsx‎

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -119,17 +119,13 @@ export function deriveProviderSettingsFields(
119119
});
120120
}
121121

122-
export function readProviderConfigString(config: unknown, key: string): string {
122+
function readProviderConfigString(config: unknown, key: string): string {
123123
if (config === null || typeof config !== "object") return "";
124124
const value = (config as Record<string, unknown>)[key];
125125
return typeof value === "string" ? value : "";
126126
}
127127

128-
export function readProviderConfigBoolean(
129-
config: unknown,
130-
key: string,
131-
defaultValue = false,
132-
): boolean {
128+
function readProviderConfigBoolean(config: unknown, key: string, defaultValue = false): boolean {
133129
if (config === null || typeof config !== "object") return defaultValue;
134130
const value = (config as Record<string, unknown>)[key];
135131
return typeof value === "boolean" ? value : defaultValue;

0 commit comments

Comments
 (0)