Skip to content

Commit

Permalink
test: correct test cases
Browse files Browse the repository at this point in the history
  • Loading branch information
louis-jan committed Oct 22, 2024
1 parent f520133 commit 26a3405
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 18 deletions.
9 changes: 4 additions & 5 deletions core/src/node/api/restful/helper/consts.test.ts
Original file line number Diff line number Diff line change
@@ -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)
})
20 changes: 7 additions & 13 deletions core/src/node/api/restful/helper/startStopModel.test.ts
Original file line number Diff line number Diff line change
@@ -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()
})
})
2 changes: 2 additions & 0 deletions core/src/node/api/restful/helper/startStopModel.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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 }),
})
}
Expand All @@ -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 }),
})
}
1 change: 1 addition & 0 deletions web/hooks/useModels.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ describe('useModels', () => {
filter: () => models,
}),
}),
get: () => undefined,
},
})

Expand Down

0 comments on commit 26a3405

Please sign in to comment.