From 0bdd99df7cddbb0dd9a6e9d41b371599bc42b970 Mon Sep 17 00:00:00 2001 From: Philippe Martin Date: Tue, 23 Jan 2024 12:03:32 +0100 Subject: [PATCH] fix windows path --- packages/backend/src/managers/modelsManager.spec.ts | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/packages/backend/src/managers/modelsManager.spec.ts b/packages/backend/src/managers/modelsManager.spec.ts index 17ecfb74e..288ebdc42 100644 --- a/packages/backend/src/managers/modelsManager.spec.ts +++ b/packages/backend/src/managers/modelsManager.spec.ts @@ -1,5 +1,5 @@ import { type MockInstance, beforeEach, expect, test, vi } from 'vitest'; -import os from 'os'; +import os, { platform } from 'os'; import fs from 'node:fs'; import path from 'node:path'; import { ModelsManager } from './modelsManager'; @@ -64,5 +64,9 @@ test('getLocalModels should return an empty array if the models folder does not const manager = new ModelsManager('/home/user/aistudio'); const models = manager.getLocalModels(); expect(models).toEqual([]); - expect(existsSyncSpy).toHaveBeenCalledWith('/home/user/aistudio/models'); + if (process.platform === 'win32') { + expect(existsSyncSpy).toHaveBeenCalledWith('\\home\\user\\aistudio\\models'); + } else { + expect(existsSyncSpy).toHaveBeenCalledWith('/home/user/aistudio/models'); + } });