fix: tests - useModels with remote models filter

This commit is contained in:
Louis 2024-10-21 17:22:15 +07:00
parent 8129c2319f
commit 895c3d4246
No known key found for this signature in database
GPG Key ID: 44FA9F4D33C37DE2
2 changed files with 4 additions and 4 deletions

View File

@ -1,5 +1,4 @@
import JanModelExtension from './index' import JanModelExtension from './index'
import { Model } from '@janhq/core'
let SETTINGS = [] let SETTINGS = []
// @ts-ignore // @ts-ignore
@ -72,7 +71,7 @@ describe('JanModelExtension', () => {
}) })
it('should update a model', async () => { it('should update a model', async () => {
const model: Partial<Model> = { id: 'test-model' } const model = { id: 'test-model' }
const updatedModel = await extension.updateModel(model) const updatedModel = await extension.updateModel(model)
expect(updatedModel).toEqual({}) expect(updatedModel).toEqual({})
expect(mockCortexAPI.updateModel).toHaveBeenCalledWith(model) expect(mockCortexAPI.updateModel).toHaveBeenCalledWith(model)

View File

@ -1,5 +1,4 @@
// useModels.test.ts // useModels.test.ts
import { renderHook, act } from '@testing-library/react' import { renderHook, act } from '@testing-library/react'
import { events, ModelEvent, ModelManager } from '@janhq/core' import { events, ModelEvent, ModelManager } from '@janhq/core'
import { extensionManager } from '@/extension' import { extensionManager } from '@/extension'
@ -28,7 +27,9 @@ describe('useModels', () => {
;(ModelManager.instance as jest.Mock).mockReturnValue({ ;(ModelManager.instance as jest.Mock).mockReturnValue({
models: { models: {
values: () => ({ values: () => ({
toArray: () => {}, toArray: () => ({
filter: () => models,
}),
}), }),
}, },
}) })