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