Skip to content

Commit 6c051fd

Browse files
test(providers): expect propagated AbortSignal in OpenAI-compatible provider specs
The AbortSignal propagation change passes a second argument `{ signal }` to `chat.completions.create`. Fireworks, SambaNova and Z AI specs still asserted the second arg as `undefined`, causing 6 failures in platform-unit-test. Update them to match the base provider spec pattern: `expect.objectContaining({ signal: expect.any(AbortSignal) })`.
1 parent b7156e8 commit 6c051fd

3 files changed

Lines changed: 46 additions & 25 deletions

File tree

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

Lines changed: 44 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -95,25 +95,46 @@ describe("FireworksHandler", () => {
9595
})
9696

9797
it.each([
98-
{ modelId: "accounts/fireworks/models/glm-5p1" as const, contextWindow: 202752, inputPrice: 1.4, outputPrice: 4.4, cacheReadsPrice: 0.26 },
99-
{ modelId: "accounts/fireworks/models/kimi-k2p6" as const, contextWindow: 262144, inputPrice: 0.95, outputPrice: 4.0, cacheReadsPrice: 0.16 },
100-
{ modelId: "accounts/fireworks/models/deepseek-v4-pro" as const, contextWindow: 1048576, inputPrice: 1.74, outputPrice: 3.48, cacheReadsPrice: 0.14 },
101-
])("should expose newly added model $modelId", ({ modelId, contextWindow, inputPrice, outputPrice, cacheReadsPrice }) => {
102-
expect(fireworksModels[modelId]).toBeDefined()
103-
const info = fireworksModels[modelId]
104-
expect(info.maxTokens).toBeGreaterThan(0)
105-
expect(info.contextWindow).toBe(contextWindow)
106-
expect(info.inputPrice).toBe(inputPrice)
107-
expect(info.outputPrice).toBe(outputPrice)
108-
expect(info.cacheReadsPrice).toBe(cacheReadsPrice)
109-
expect(info.description).toBeTruthy()
110-
111-
const handlerWithModel = new FireworksHandler({
112-
apiModelId: modelId,
113-
fireworksApiKey: "test-fireworks-api-key",
114-
})
115-
expect(handlerWithModel.getModel().id).toBe(modelId)
116-
})
98+
{
99+
modelId: "accounts/fireworks/models/glm-5p1" as const,
100+
contextWindow: 202752,
101+
inputPrice: 1.4,
102+
outputPrice: 4.4,
103+
cacheReadsPrice: 0.26,
104+
},
105+
{
106+
modelId: "accounts/fireworks/models/kimi-k2p6" as const,
107+
contextWindow: 262144,
108+
inputPrice: 0.95,
109+
outputPrice: 4.0,
110+
cacheReadsPrice: 0.16,
111+
},
112+
{
113+
modelId: "accounts/fireworks/models/deepseek-v4-pro" as const,
114+
contextWindow: 1048576,
115+
inputPrice: 1.74,
116+
outputPrice: 3.48,
117+
cacheReadsPrice: 0.14,
118+
},
119+
])(
120+
"should expose newly added model $modelId",
121+
({ modelId, contextWindow, inputPrice, outputPrice, cacheReadsPrice }) => {
122+
expect(fireworksModels[modelId]).toBeDefined()
123+
const info = fireworksModels[modelId]
124+
expect(info.maxTokens).toBeGreaterThan(0)
125+
expect(info.contextWindow).toBe(contextWindow)
126+
expect(info.inputPrice).toBe(inputPrice)
127+
expect(info.outputPrice).toBe(outputPrice)
128+
expect(info.cacheReadsPrice).toBe(cacheReadsPrice)
129+
expect(info.description).toBeTruthy()
130+
131+
const handlerWithModel = new FireworksHandler({
132+
apiModelId: modelId,
133+
fireworksApiKey: "test-fireworks-api-key",
134+
})
135+
expect(handlerWithModel.getModel().id).toBe(modelId)
136+
},
137+
)
117138

118139
it("should return Kimi K2 Instruct model with correct configuration", () => {
119140
const testModelId: FireworksModelId = "accounts/fireworks/models/kimi-k2-instruct"
@@ -465,7 +486,7 @@ describe("FireworksHandler", () => {
465486
stream: true,
466487
stream_options: { include_usage: true },
467488
}),
468-
undefined,
489+
expect.objectContaining({ signal: expect.any(AbortSignal) }),
469490
)
470491
})
471492

@@ -491,7 +512,7 @@ describe("FireworksHandler", () => {
491512
expect.objectContaining({
492513
temperature: 0.5,
493514
}),
494-
undefined,
515+
expect.objectContaining({ signal: expect.any(AbortSignal) }),
495516
)
496517
})
497518

@@ -518,7 +539,7 @@ describe("FireworksHandler", () => {
518539
expect.objectContaining({
519540
temperature: 1.0,
520541
}),
521-
undefined,
542+
expect.objectContaining({ signal: expect.any(AbortSignal) }),
522543
)
523544
})
524545

@@ -546,7 +567,7 @@ describe("FireworksHandler", () => {
546567
expect.objectContaining({
547568
temperature: 0.7,
548569
}),
549-
undefined,
570+
expect.objectContaining({ signal: expect.any(AbortSignal) }),
550571
)
551572
})
552573

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -146,7 +146,7 @@ describe("SambaNovaHandler", () => {
146146
stream: true,
147147
stream_options: { include_usage: true },
148148
}),
149-
undefined,
149+
expect.objectContaining({ signal: expect.any(AbortSignal) }),
150150
)
151151
})
152152
})

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -469,7 +469,7 @@ describe("ZAiHandler", () => {
469469
stream: true,
470470
stream_options: { include_usage: true },
471471
}),
472-
undefined,
472+
expect.objectContaining({ signal: expect.any(AbortSignal) }),
473473
)
474474
})
475475
})

0 commit comments

Comments
 (0)