diff --git a/invokeai/frontend/web/src/features/nodes/types/common.test-d.ts b/invokeai/frontend/web/src/features/nodes/types/common.test-d.ts new file mode 100644 index 0000000000..7f28e864a1 --- /dev/null +++ b/invokeai/frontend/web/src/features/nodes/types/common.test-d.ts @@ -0,0 +1,69 @@ +import type { + BaseModel, + BoardField, + Classification, + CLIPField, + ColorField, + ControlField, + ControlNetModelField, + ImageField, + ImageOutput, + IPAdapterField, + IPAdapterModelField, + LoraInfo, + LoRAModelField, + MainModelField, + ModelInfo, + ModelType, + ProgressImage, + SchedulerField, + SDXLRefinerModelField, + SubModelType, + T2IAdapterField, + T2IAdapterModelField, + UNetField, + VAEField, +} from 'features/nodes/types/common'; +import type { S } from 'services/api/types'; +import type { Equals, Extends } from 'tsafe'; +import { assert } from 'tsafe'; +import { describe, test } from 'vitest'; + +/** + * These types originate from the server and are recreated as zod schemas manually, for use at runtime. + * The tests ensure that the types are correctly recreated. + */ + +describe('Common types', () => { + // Complex field types + test('ImageField', () => assert>()); + test('BoardField', () => assert>()); + test('ColorField', () => assert>()); + test('SchedulerField', () => assert>>()); + test('UNetField', () => assert>()); + test('CLIPField', () => assert>()); + test('MainModelField', () => assert>()); + test('SDXLRefinerModelField', () => assert>()); + test('VAEField', () => assert>()); + test('ControlField', () => assert>()); + // @ts-expect-error TODO(psyche): fix types + test('IPAdapterField', () => assert>()); + test('T2IAdapterField', () => assert>()); + test('LoRAModelField', () => assert>()); + test('ControlNetModelField', () => assert>()); + test('IPAdapterModelField', () => assert>()); + test('T2IAdapterModelField', () => assert>()); + + // Model component types + test('BaseModel', () => assert>()); + test('ModelType', () => assert>()); + test('SubModelType', () => assert>()); + test('ModelInfo', () => assert>()); + + // Misc types + test('LoraInfo', () => assert>()); + // @ts-expect-error TODO(psyche): There is no `ProgressImage` in the server types yet + test('ProgressImage', () => assert>()); + test('ImageOutput', () => assert>()); + test('Classification', () => assert>()); +}); diff --git a/invokeai/frontend/web/src/features/nodes/types/workflow.test-d.ts b/invokeai/frontend/web/src/features/nodes/types/workflow.test-d.ts new file mode 100644 index 0000000000..7cb1ea230c --- /dev/null +++ b/invokeai/frontend/web/src/features/nodes/types/workflow.test-d.ts @@ -0,0 +1,18 @@ +import type { WorkflowCategory, WorkflowV3, XYPosition } from 'features/nodes/types/workflow'; +import type * as ReactFlow from 'reactflow'; +import type { S } from 'services/api/types'; +import type { Equals, Extends } from 'tsafe'; +import { assert } from 'tsafe'; +import { describe, test } from 'vitest'; + +/** + * These types originate from the server and are recreated as zod schemas manually, for use at runtime. + * The tests ensure that the types are correctly recreated. + */ + +describe('Workflow types', () => { + test('XYPosition', () => assert>()); + test('WorkflowCategory', () => assert>()); + // @ts-expect-error TODO(psyche): Need to revise server types! + test('WorkflowV3', () => assert>()); +});