|
|
|
@ -47,7 +47,7 @@ describe("composerPricing", () => { |
|
|
|
config: draft({ |
|
|
|
selectedModel: model({ |
|
|
|
modelId: "123", |
|
|
|
displayName: "Token billed video", |
|
|
|
displayName: "Seedance token video", |
|
|
|
billingMethod: 2, |
|
|
|
aiModelCode: "video-code", |
|
|
|
aiModelCodeAlias: "video-alias", |
|
|
|
@ -70,7 +70,7 @@ describe("composerPricing", () => { |
|
|
|
}); |
|
|
|
}); |
|
|
|
|
|
|
|
it("skips quote requests for llm and models without a billing method", () => { |
|
|
|
it("skips quote requests for llm drafts and Seedance models without a billing method", () => { |
|
|
|
expect(buildPopiserverPriceQuoteRequest(context({ |
|
|
|
capability: "llm", |
|
|
|
config: draft(), |
|
|
|
@ -83,10 +83,23 @@ describe("composerPricing", () => { |
|
|
|
}))).toBeNull(); |
|
|
|
}); |
|
|
|
|
|
|
|
it("routes purely by billingMethod (2 -> estimate, 1 -> task-price)", () => { |
|
|
|
it("routes Seedance models by billingMethod and everything else to task-price", () => { |
|
|
|
// Seedance + billingMethod 2 -> estimate
|
|
|
|
expect(buildPopiserverPriceQuoteRequest(context({ config: draft({ |
|
|
|
selectedModel: model({ billingMethod: 2 }), |
|
|
|
selectedModel: model({ displayName: "Seedance Pro", billingMethod: 2 }), |
|
|
|
}) }))).toMatchObject({ source: "estimate" }); |
|
|
|
// Seedance + billingMethod 1 -> task-price
|
|
|
|
expect(buildPopiserverPriceQuoteRequest(context({ |
|
|
|
capability: "video", |
|
|
|
config: draft({ |
|
|
|
selectedModel: model({ |
|
|
|
displayName: "Seedance Pro", |
|
|
|
billingMethod: 1, |
|
|
|
aiModelId: 44, |
|
|
|
}), |
|
|
|
}), |
|
|
|
}))).toMatchObject({ source: "task-price" }); |
|
|
|
// Non-Seedance models always use task-price, regardless of billingMethod.
|
|
|
|
expect(buildPopiserverPriceQuoteRequest(context({ config: draft({ |
|
|
|
selectedModel: model({ |
|
|
|
billingMethod: 1, |
|
|
|
@ -96,17 +109,15 @@ describe("composerPricing", () => { |
|
|
|
subType: 101, |
|
|
|
}), |
|
|
|
}) }))).toMatchObject({ source: "task-price" }); |
|
|
|
// Seedance name no longer forces estimate; billingMethod 1 -> task-price.
|
|
|
|
expect(buildPopiserverPriceQuoteRequest(context({ |
|
|
|
capability: "video", |
|
|
|
config: draft({ |
|
|
|
expect(buildPopiserverPriceQuoteRequest(context({ config: draft({ |
|
|
|
selectedModel: model({ |
|
|
|
displayName: "Seedance Pro", |
|
|
|
billingMethod: 1, |
|
|
|
aiModelId: 44, |
|
|
|
}), |
|
|
|
billingMethod: 2, |
|
|
|
aiModelId: 33, |
|
|
|
aiModelCode: "image-code", |
|
|
|
type: 1, |
|
|
|
subType: 101, |
|
|
|
}), |
|
|
|
}))).toMatchObject({ source: "task-price" }); |
|
|
|
}) }))).toMatchObject({ source: "task-price" }); |
|
|
|
}); |
|
|
|
|
|
|
|
it("does not forward batchSize in estimate payloads (backend ignores it)", () => { |
|
|
|
@ -136,7 +147,7 @@ describe("composerPricing", () => { |
|
|
|
|
|
|
|
it("builds unified PopiServer quote requests", () => { |
|
|
|
const estimateContext = context({ config: draft({ |
|
|
|
selectedModel: model({ billingMethod: 2 }), |
|
|
|
selectedModel: model({ displayName: "Seedance Pro", billingMethod: 2 }), |
|
|
|
}) }); |
|
|
|
|
|
|
|
expect(buildPopiserverPriceQuoteRequest(estimateContext)).toMatchObject({ |
|
|
|
|