|
|
|
@ -21,14 +21,12 @@ function model(overrides: Partial<SelectedModel> = {}): SelectedModel { |
|
|
|
function draft(overrides: Partial<GenerationNodeConfig> = {}): GenerationNodeConfig { |
|
|
|
return { |
|
|
|
prompt: "prompt", |
|
|
|
aspectRatio: "16:9", |
|
|
|
resolution: "1080p", |
|
|
|
selectedModel: model(), |
|
|
|
inputImages: [], |
|
|
|
imageCount: 1, |
|
|
|
durationSeconds: 6, |
|
|
|
soundEnabled: true, |
|
|
|
referenceSubjectList: [], |
|
|
|
parameters: {}, |
|
|
|
extraTaskParams: {}, |
|
|
|
...overrides, |
|
|
|
}; |
|
|
|
} |
|
|
|
@ -39,20 +37,17 @@ describe("composerPricing", () => { |
|
|
|
selectedModel: model({ |
|
|
|
modelId: "123", |
|
|
|
displayName: "Token billed video", |
|
|
|
metadata: { |
|
|
|
billingMethod: 2, |
|
|
|
aiModelCode: "video-code", |
|
|
|
aiModelCodeAlias: "video-alias", |
|
|
|
}, |
|
|
|
billingMethod: 2, |
|
|
|
aiModelCode: "video-code", |
|
|
|
aiModelCodeAlias: "video-alias", |
|
|
|
}), |
|
|
|
resolution: "", |
|
|
|
durationSeconds: 8, |
|
|
|
parameters: { duration: 8 }, |
|
|
|
}), "video", 12); |
|
|
|
|
|
|
|
expect(payload).toEqual({ |
|
|
|
model_name: "video-alias", |
|
|
|
estimation_type: "auto", |
|
|
|
parameters: {}, |
|
|
|
parameters: { duration: 8 }, |
|
|
|
imageCount: 1, |
|
|
|
input_video_duration_seconds: 12, |
|
|
|
}); |
|
|
|
@ -67,22 +62,22 @@ describe("composerPricing", () => { |
|
|
|
|
|
|
|
it("uses PopiServer estimate only for billingMethod 2 or Seedance models", () => { |
|
|
|
expect(buildPopiserverPointsEstimatePayload(draft({ |
|
|
|
selectedModel: model({ metadata: { billingMethod: 2 } }), |
|
|
|
selectedModel: model({ billingMethod: 2 }), |
|
|
|
}), "image", 0)).not.toBeNull(); |
|
|
|
expect(buildPopiserverPointsEstimatePayload(draft({ |
|
|
|
selectedModel: model({ metadata: { billingMethod: 1 } }), |
|
|
|
selectedModel: model({ billingMethod: 1 }), |
|
|
|
}), "image", 0)).toBeNull(); |
|
|
|
expect(buildPopiserverPointsEstimatePayload(draft({ |
|
|
|
selectedModel: model({ |
|
|
|
displayName: "Seedance Pro", |
|
|
|
metadata: { billingMethod: 1 }, |
|
|
|
billingMethod: 1, |
|
|
|
}), |
|
|
|
}), "video", 0)).not.toBeNull(); |
|
|
|
}); |
|
|
|
|
|
|
|
it("builds unified PopiServer quote requests", () => { |
|
|
|
const pointsPayload = buildPopiserverPointsEstimatePayload(draft({ |
|
|
|
selectedModel: model({ metadata: { billingMethod: 2 } }), |
|
|
|
selectedModel: model({ billingMethod: 2 }), |
|
|
|
}), "image", 0); |
|
|
|
const taskPricePayload = { aiModelId: 32 }; |
|
|
|
|
|
|
|
|