From 98db40450bfe1aa6f742b6117ff3492fdcc847a7 Mon Sep 17 00:00:00 2001 From: Robin Huang Date: Fri, 15 Nov 2024 16:08:20 -0800 Subject: [PATCH] Fixed: Error when user does not choose migration location (#268) * Hack: Return empty * Fix test. --- src/config/comfyServerConfig.ts | 4 ++-- tests/unit/comfyServerConfig.test.ts | 4 +++- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/src/config/comfyServerConfig.ts b/src/config/comfyServerConfig.ts index 02cfc01b..b40c08ec 100644 --- a/src/config/comfyServerConfig.ts +++ b/src/config/comfyServerConfig.ts @@ -208,9 +208,9 @@ export class ComfyServerConfig { public static async getMigrationConfig( migrationSource?: string, migrationItemIds: Set = new Set() - ): Promise> { + ): Promise<{ comfyui: ModelPaths } & Record> { if (!migrationSource || !migrationItemIds.has('models')) { - return {}; + return { comfyui: {} }; } // The yaml file exited in migration source repo. const migrationServerConfig = await ComfyServerConfig.getConfigFromRepoPath(migrationSource); diff --git a/tests/unit/comfyServerConfig.test.ts b/tests/unit/comfyServerConfig.test.ts index db5ad023..4d7cb2dd 100644 --- a/tests/unit/comfyServerConfig.test.ts +++ b/tests/unit/comfyServerConfig.test.ts @@ -141,7 +141,9 @@ comfyui: describe('getMigrationConfig', () => { it('should return empty object when no migration source is provided', async () => { const result = await ComfyServerConfig.getMigrationConfig(undefined); - expect(result).toEqual({}); + expect(result).toEqual({ + comfyui: {}, + }); }); it('should merge configs and remove custom_nodes when migration source is provided', async () => {