test: correct test cases

This commit is contained in:
Louis 2024-10-22 17:09:24 +07:00
parent e8a9e8e28c
commit 9afbfd609a
No known key found for this signature in database
GPG Key ID: 44FA9F4D33C37DE2
4 changed files with 14 additions and 18 deletions

View File

@ -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)
})

View File

@ -1,5 +1,3 @@
import { startModel } from './startStopModel'
describe('startModel', () => {
@ -7,10 +5,6 @@
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()
})
})

View File

@ -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 }),
})
}

View File

@ -31,6 +31,7 @@ describe('useModels', () => {
filter: () => models,
}),
}),
get: () => undefined,
},
})