test: correct test cases
This commit is contained in:
parent
e8a9e8e28c
commit
9afbfd609a
@ -1,6 +1,5 @@
|
||||
import { CORTEX_DEFAULT_PORT } from './consts'
|
||||
|
||||
import { NITRO_DEFAULT_PORT } from './consts';
|
||||
|
||||
it('should test NITRO_DEFAULT_PORT', () => {
|
||||
expect(NITRO_DEFAULT_PORT).toBe(3928);
|
||||
});
|
||||
it('should test CORTEX_DEFAULT_PORT', () => {
|
||||
expect(CORTEX_DEFAULT_PORT).toBe(39291)
|
||||
})
|
||||
|
||||
@ -1,16 +1,10 @@
|
||||
import { startModel } from './startStopModel'
|
||||
|
||||
describe('startModel', () => {
|
||||
it('test_startModel_error', async () => {
|
||||
const modelId = 'testModelId'
|
||||
const settingParams = undefined
|
||||
|
||||
import { startModel } from './startStopModel'
|
||||
|
||||
describe('startModel', () => {
|
||||
it('test_startModel_error', async () => {
|
||||
const modelId = 'testModelId'
|
||||
const settingParams = undefined
|
||||
|
||||
const result = await startModel(modelId, settingParams)
|
||||
|
||||
expect(result).toEqual({
|
||||
error: expect.any(Error),
|
||||
})
|
||||
})
|
||||
expect(startModel(modelId, settingParams)).resolves.toThrow()
|
||||
})
|
||||
})
|
||||
|
||||
@ -9,6 +9,7 @@ import { CORTEX_DEFAULT_PORT, LOCAL_HOST } from './consts'
|
||||
*/
|
||||
export const startModel = async (modelId: string, settingParams?: ModelSettingParams) => {
|
||||
return fetch(`http://${LOCAL_HOST}:${CORTEX_DEFAULT_PORT}/v1/models/start`, {
|
||||
method: 'POST',
|
||||
body: JSON.stringify({ model: modelId, ...settingParams }),
|
||||
})
|
||||
}
|
||||
@ -18,6 +19,7 @@ export const startModel = async (modelId: string, settingParams?: ModelSettingPa
|
||||
*/
|
||||
export const stopModel = async (modelId: string) => {
|
||||
return fetch(`http://${LOCAL_HOST}:${CORTEX_DEFAULT_PORT}/v1/models/stop`, {
|
||||
method: 'POST',
|
||||
body: JSON.stringify({ model: modelId }),
|
||||
})
|
||||
}
|
||||
|
||||
@ -31,6 +31,7 @@ describe('useModels', () => {
|
||||
filter: () => models,
|
||||
}),
|
||||
}),
|
||||
get: () => undefined,
|
||||
},
|
||||
})
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user