fix: update tests for SchemaConfigFields and comingSoon logic

- registry.test: fallback now uses SchemaConfigFields, not ProcessConfigFields
- metadata.test: isEnabledAdapterType checks comingSoon first so
  intentionally withheld built-in adapters (process/http) stay disabled
This commit is contained in:
HenkDz 2026-04-01 23:23:14 +01:00
parent d7a7bda209
commit 388650afc7
2 changed files with 10 additions and 7 deletions

View file

@ -26,9 +26,11 @@ export function listKnownAdapterTypes(): string[] {
* Unknown types (external adapters) are always considered enabled. * Unknown types (external adapters) are always considered enabled.
*/ */
export function isEnabledAdapterType(type: string): boolean { export function isEnabledAdapterType(type: string): boolean {
// Known external adapter — always valid // Check display registry first — built-in adapters like process/http are
if (listUIAdapters().some((a) => a.type === type)) return true; // intentionally withheld even though they're registered as UI adapters.
return !getAdapterDisplay(type).comingSoon; if (getAdapterDisplay(type).comingSoon) return false;
// All other types (registered or external) are enabled.
return true;
} }
/** /**
@ -37,8 +39,8 @@ export function isEnabledAdapterType(type: string): boolean {
* any non-"coming soon" adapter from the display registry. * any non-"coming soon" adapter from the display registry.
*/ */
export function isValidAdapterType(type: string): boolean { export function isValidAdapterType(type: string): boolean {
if (listUIAdapters().some((a) => a.type === type)) return true; if (getAdapterDisplay(type).comingSoon) return false;
return !getAdapterDisplay(type).comingSoon; return true;
} }
/** /**

View file

@ -8,6 +8,7 @@ import {
unregisterUIAdapter, unregisterUIAdapter,
} from "./registry"; } from "./registry";
import { processUIAdapter } from "./process"; import { processUIAdapter } from "./process";
import { SchemaConfigFields } from "./schema-config-fields";
const externalUIAdapter: UIAdapterModule = { const externalUIAdapter: UIAdapterModule = {
type: "external_test", type: "external_test",
@ -44,7 +45,7 @@ describe("ui adapter registry", () => {
// Unknown types return a lazy-loading wrapper (for external adapters), // Unknown types return a lazy-loading wrapper (for external adapters),
// not the process adapter directly. The type is preserved. // not the process adapter directly. The type is preserved.
expect(fallback.type).toBe("external_test"); expect(fallback.type).toBe("external_test");
// But it uses the process parser under the hood. // But it uses the schema-based config fields for external adapter forms.
expect(fallback.ConfigFields).toBe(processUIAdapter.ConfigFields); expect(fallback.ConfigFields).toBe(SchemaConfigFields);
}); });
}); });