Skip to content

Commit 2e1c5c6

Browse files
committed
test: enhance GLM-4.6-turbo tests with compile-time assertion and exact value validation
- Add compile-time assertion ensuring GLM-4.6-turbo is part of ChutesModelId - Update test to use modelId variable for better type safety - Add comprehensive validation of all model properties with exact values - Change description formatting to multi-line style for consistency
1 parent 70ee1a5 commit 2e1c5c6

File tree

1 file changed

+19
-13
lines changed

1 file changed

+19
-13
lines changed

src/api/providers/__tests__/chutes.spec.ts

Lines changed: 19 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -493,22 +493,28 @@ describe("ChutesHandler", () => {
493493
expect(model.info.temperature).toBe(0.5)
494494
})
495495

496-
it("should include zai-org/GLM-4.6-turbo in chutesModels", () => {
497-
// This test ensures the GLM-4.6-turbo model exists to prevent regressions
498-
const modelId = "zai-org/GLM-4.6-turbo"
499-
// Compile-time assertion that GLM-4.6-turbo is part of ChutesModelId (no unused var)
500-
const expectType = <T>(_value: T) => {}
501-
expectType<ChutesModelId>(modelId)
502-
expect(chutesModels).toHaveProperty(modelId)
503-
504-
// Handler-level assertion that GLM-4.6-turbo uses the default non-DeepSeek temperature (0.5)
496+
it("should return zai-org/GLM-4.6-turbo model with correct configuration", () => {
497+
const testModelId: ChutesModelId = "zai-org/GLM-4.6-turbo"
505498
const handlerWithModel = new ChutesHandler({
506-
apiModelId: "zai-org/GLM-4.6-turbo",
499+
apiModelId: testModelId,
507500
chutesApiKey: "test-chutes-api-key",
508501
})
509-
const selected = handlerWithModel.getModel()
510-
expect(selected.info.temperature).toBe(0.5)
511-
expect(selected.info).toEqual(expect.objectContaining(chutesModels[modelId]))
502+
const model = handlerWithModel.getModel()
503+
expect(model.id).toBe(testModelId)
504+
expect(model.info).toEqual(
505+
expect.objectContaining({
506+
maxTokens: 32768,
507+
contextWindow: 202752,
508+
supportsImages: false,
509+
supportsPromptCache: false,
510+
inputPrice: 1.15,
511+
outputPrice: 3.25,
512+
description: "GLM-4.6-turbo model with 200K+ token context window, optimized for fast inference.",
513+
temperature: 0.5, // Default temperature for non-DeepSeek models
514+
}),
515+
)
516+
// Strengthen test by also asserting the selected model.info matches the static config to catch mapping/regression errors beyond temperature
517+
expect(model.info).toEqual(expect.objectContaining(chutesModels[testModelId]))
512518
})
513519

514520
it("should have correct pricing and context for zai-org/GLM-4.6-turbo", () => {

0 commit comments

Comments
 (0)