Skip to content

Commit e782967

Browse files
committed
test(types): widen moonshot registry entries to ModelInfo in tests
1 parent 2517179 commit e782967

1 file changed

Lines changed: 8 additions & 4 deletions

File tree

‎packages/types/src/__tests__/moonshot.test.ts‎

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,13 @@
1+
import type { ModelInfo } from "../model.js"
12
import { MOONSHOT_DEFAULT_TEMPERATURE, moonshotDefaultModelId, moonshotModels } from "../providers/moonshot.js"
23

4+
const modelEntries: [string, ModelInfo][] = Object.entries(moonshotModels)
5+
const modelInfos: ModelInfo[] = Object.values(moonshotModels)
6+
37
describe("moonshot registry", () => {
48
describe("moonshotModels registry invariants", () => {
59
it("every entry has a positive maxTokens and contextWindow", () => {
6-
for (const [id, info] of Object.entries(moonshotModels)) {
10+
for (const [id, info] of modelEntries) {
711
expect(info.maxTokens).toBeGreaterThan(0)
812
expect(info.contextWindow).toBeGreaterThan(0)
913
// Sanity: max output must not exceed the context window.
@@ -13,22 +17,22 @@ describe("moonshot registry", () => {
1317
})
1418

1519
it("every entry declares supportsImages and supportsPromptCache", () => {
16-
for (const info of Object.values(moonshotModels)) {
20+
for (const info of modelInfos) {
1721
expect(typeof info.supportsImages).toBe("boolean")
1822
expect(typeof info.supportsPromptCache).toBe("boolean")
1923
}
2024
})
2125

2226
it("models with an array supportsReasoningEffort expose a non-empty allow-list", () => {
23-
for (const info of Object.values(moonshotModels)) {
27+
for (const info of modelInfos) {
2428
if (Array.isArray(info.supportsReasoningEffort)) {
2529
expect(info.supportsReasoningEffort.length).toBeGreaterThan(0)
2630
}
2731
}
2832
})
2933

3034
it("every entry declares a reasoningEffort that is covered by its allow-list", () => {
31-
for (const info of Object.values(moonshotModels)) {
35+
for (const info of modelInfos) {
3236
if (Array.isArray(info.supportsReasoningEffort) && info.reasoningEffort !== undefined) {
3337
expect(info.supportsReasoningEffort).toContain(info.reasoningEffort)
3438
}

0 commit comments

Comments
 (0)