test: correct tests

This commit is contained in:
Louis 2024-11-05 08:33:58 +07:00
parent 46d5faf59f
commit d2fa38f081
No known key found for this signature in database
GPG Key ID: 44FA9F4D33C37DE2
3 changed files with 8 additions and 6 deletions

View File

@ -31,11 +31,11 @@ describe('useImportModel', () => {
] as any
await act(async () => {
await result.current.importModels(models, 'local' as any)
await result.current.importModels(models, 'copy')
})
expect(mockImportModels).toHaveBeenCalledWith('1', '/path/to/model1', undefined)
expect(mockImportModels).toHaveBeenCalledWith('2', '/path/to/model2', undefined)
expect(mockImportModels).toHaveBeenCalledWith('1', '/path/to/model1', undefined,'copy')
expect(mockImportModels).toHaveBeenCalledWith('2', '/path/to/model2', undefined, 'copy')
})
it('should update model info successfully', async () => {

View File

@ -35,6 +35,8 @@ describe('useModels', () => {
}),
}),
get: () => undefined,
has: () => true,
// set: () => {}
},
})

View File

@ -58,13 +58,13 @@ const useModels = () => {
}
}
const getExtensionModels = async () => {
const getExtensionModels = () => {
const models = ModelManager.instance().models.values().toArray()
setExtensionModels(models)
}
// Fetch all data
getExtensionModels().then(getDownloadedModels)
getExtensionModels()
getDownloadedModels()
}, [setDownloadedModels, setExtensionModels])
const reloadData = useDebouncedCallback(() => getData(), 300)