mirror of
https://github.com/Comfy-Org/ComfyUI_frontend.git
synced 2026-03-07 14:09:59 +00:00
fix: remove test settings from production schema
Remove 5 test setting IDs that were incorrectly added to the production apiSchema.ts. Test settings now use `as TestSettingId` casts in test files instead of polluting the production Settings type. Changes: - Remove TestSetting, TestHiddenSetting, TestDeprecatedSetting, TestVisibleSetting, Comfy.TestSetting from apiSchema.ts - Add TestSettingId type helper to extensionAPI.spec.ts and useSettingSearch.spec.ts - Use specific `as TestSettingId` casts with explanatory comments This keeps production types clean while allowing tests to register arbitrary setting IDs (which is valid extension behavior). Amp-Thread-ID: https://ampcode.com/threads/T-019c1833-2352-728b-a523-a8f440fd3ba1 Co-authored-by: Amp <amp@ampcode.com>
This commit is contained in:
@@ -1,8 +1,17 @@
|
||||
import { expect } from '@playwright/test'
|
||||
|
||||
import type { Settings } from '../../src/schemas/apiSchema'
|
||||
import type { SettingParams } from '../../src/platform/settings/types'
|
||||
import { comfyPageFixture as test } from '../fixtures/ComfyPage'
|
||||
|
||||
/**
|
||||
* Type helper for test settings with arbitrary IDs.
|
||||
* Extensions can register settings with any ID, but SettingParams.id
|
||||
* is typed as keyof Settings for autocomplete. This helper allows
|
||||
* arbitrary IDs in tests while keeping type safety for other fields.
|
||||
*/
|
||||
type TestSettingId = keyof Settings
|
||||
|
||||
test.describe('Topbar commands', () => {
|
||||
test.beforeEach(async ({ comfyPage }) => {
|
||||
await comfyPage.settings.setSetting('Comfy.UseNewMenu', 'Top')
|
||||
@@ -87,7 +96,8 @@ test.describe('Topbar commands', () => {
|
||||
name: 'TestExtension1',
|
||||
settings: [
|
||||
{
|
||||
id: 'TestSetting',
|
||||
// Extensions can register arbitrary setting IDs
|
||||
id: 'TestSetting' as TestSettingId,
|
||||
name: 'Test Setting',
|
||||
type: 'text',
|
||||
defaultValue: 'Hello, world!',
|
||||
@@ -117,7 +127,8 @@ test.describe('Topbar commands', () => {
|
||||
name: 'TestExtension1',
|
||||
settings: [
|
||||
{
|
||||
id: 'Comfy.TestSetting',
|
||||
// Extensions can register arbitrary setting IDs
|
||||
id: 'Comfy.TestSetting' as TestSettingId,
|
||||
name: 'Test Setting',
|
||||
type: 'boolean',
|
||||
defaultValue: false,
|
||||
@@ -202,7 +213,8 @@ test.describe('Topbar commands', () => {
|
||||
name: 'TestExtension1',
|
||||
settings: [
|
||||
{
|
||||
id: 'Comfy.TestSetting',
|
||||
// Extensions can register arbitrary setting IDs
|
||||
id: 'Comfy.TestSetting' as TestSettingId,
|
||||
name: 'Test',
|
||||
attrs: { disabled: true },
|
||||
...config
|
||||
|
||||
Reference in New Issue
Block a user