test: correct tests
This commit is contained in:
parent
46d5faf59f
commit
d2fa38f081
@ -31,11 +31,11 @@ describe('useImportModel', () => {
|
|||||||
] as any
|
] as any
|
||||||
|
|
||||||
await act(async () => {
|
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('1', '/path/to/model1', undefined,'copy')
|
||||||
expect(mockImportModels).toHaveBeenCalledWith('2', '/path/to/model2', undefined)
|
expect(mockImportModels).toHaveBeenCalledWith('2', '/path/to/model2', undefined, 'copy')
|
||||||
})
|
})
|
||||||
|
|
||||||
it('should update model info successfully', async () => {
|
it('should update model info successfully', async () => {
|
||||||
|
|||||||
@ -35,6 +35,8 @@ describe('useModels', () => {
|
|||||||
}),
|
}),
|
||||||
}),
|
}),
|
||||||
get: () => undefined,
|
get: () => undefined,
|
||||||
|
has: () => true,
|
||||||
|
// set: () => {}
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|||||||
@ -58,13 +58,13 @@ const useModels = () => {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
const getExtensionModels = async () => {
|
const getExtensionModels = () => {
|
||||||
const models = ModelManager.instance().models.values().toArray()
|
const models = ModelManager.instance().models.values().toArray()
|
||||||
setExtensionModels(models)
|
setExtensionModels(models)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Fetch all data
|
// Fetch all data
|
||||||
getExtensionModels().then(getDownloadedModels)
|
getExtensionModels()
|
||||||
|
getDownloadedModels()
|
||||||
}, [setDownloadedModels, setExtensionModels])
|
}, [setDownloadedModels, setExtensionModels])
|
||||||
|
|
||||||
const reloadData = useDebouncedCallback(() => getData(), 300)
|
const reloadData = useDebouncedCallback(() => getData(), 300)
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user