Skip to content

Commit 224824a

Browse files
committed
test(api): cover service tier fallbacks
1 parent 9cdcbee commit 224824a

2 files changed

Lines changed: 34 additions & 0 deletions

File tree

src/api/providers/__tests__/openai-native.spec.ts

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -501,6 +501,28 @@ describe("OpenAiNativeHandler", () => {
501501
expect(result.totalCost).toBeCloseTo(0.22, 6)
502502
})
503503

504+
it("should retain standard pricing when no service tier is selected", () => {
505+
const model = handler.getModel()
506+
const applyServiceTierPricing = Reflect.get(handler, "applyServiceTierPricing")
507+
508+
const result = Reflect.apply(applyServiceTierPricing, handler, [model.info])
509+
510+
expect(result).toBe(model.info)
511+
})
512+
513+
it("should retain standard pricing when the resolved service tier has no pricing entry", () => {
514+
const model = handler.getModel()
515+
const infoWithoutTiers = { ...model.info, tiers: undefined }
516+
const applyServiceTierPricing = Reflect.get(handler, "applyServiceTierPricing")
517+
518+
const result = Reflect.apply(applyServiceTierPricing, handler, [
519+
infoWithoutTiers,
520+
OpenAiServiceTier.Priority,
521+
])
522+
523+
expect(result).toBe(infoWithoutTiers)
524+
})
525+
504526
it("should return GPT-5.3 Chat model info when selected", () => {
505527
const chatHandler = new OpenAiNativeHandler({
506528
...mockOptions,

webview-ui/src/components/settings/__tests__/ModelInfoView.spec.tsx

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -94,4 +94,16 @@ describe("ModelInfoView service tier pricing", () => {
9494

9595
expect(screen.queryByText("Service tier pricing")).not.toBeInTheDocument()
9696
})
97+
98+
it("does not show the tier pricing table when model info has no tiers", () => {
99+
render(
100+
<ModelInfoView
101+
{...defaultProps}
102+
apiProvider={providerIdentifiers.openaiNative}
103+
modelInfo={baseModelInfo}
104+
/>,
105+
)
106+
107+
expect(screen.queryByText("Service tier pricing")).not.toBeInTheDocument()
108+
})
97109
})

0 commit comments

Comments
 (0)