Skip to content

armgit / jan

Public Imported from GitHub
0

Jan is an open source alternative to ChatGPT that runs 100% offline on your computer.

test: enhance ModelFactory tests to verify model loading and invocation of foundation models

dev-miro265d61cb0edad3
diff --git a/web-app/src/lib/__tests__/model-factory.test.ts b/web-app/src/lib/__tests__/model-factory.test.ts
index c611b789d..698b4eb1a 100644
--- a/web-app/src/lib/__tests__/model-factory.test.ts
+++ b/web-app/src/lib/__tests__/model-factory.test.ts
@@ -246,6 +246,19 @@ describe('ModelFactory', () => {
).rejects.toThrow(
'No running Foundation Models session. The model may have failed to load — please check the logs.'
)
+
+ expect(mockStartModel).toHaveBeenCalledWith(
+ foundationModelsProvider,
+ 'apple/on-device'
+ )
+ expect(mockedInvoke).toHaveBeenCalledWith(
+ 'plugin:foundation-models|check_foundation_models_availability',
+ {}
+ )
+ expect(mockedInvoke).toHaveBeenCalledWith(
+ 'plugin:foundation-models|is_foundation_models_loaded',
+ {}
+ )
})
it('should create a model when available and model is loaded', async () => {
@@ -259,6 +272,10 @@ describe('ModelFactory', () => {
)
expect(model).toBeDefined()
+ expect(mockStartModel).toHaveBeenCalledWith(
+ foundationModelsProvider,
+ 'apple/on-device'
+ )
expect(mockedInvoke).toHaveBeenCalledWith(
'plugin:foundation-models|check_foundation_models_availability',
{}