功能增加
This commit is contained in:
1 parent
b340fc7ad7
commit
f1993eb388
69 files changed
+2243
-162
No files matched your search
@@ -0,0 +1,22 @@
|
||||
package billing
|
||||
|
||||
import "testing"
|
||||
|
||||
func TestA4QuoteUsesExisting1KCostAndMarkup(t *testing.T) {
|
||||
for _, size := range []struct {
|
||||
width, height int
|
||||
ratio string
|
||||
}{{1680, 2376, "70:99"}, {2376, 1680, "99:70"}, {848, 1200, "70:99"}, {1200, 848, "99:70"}} {
|
||||
dimensions := map[string]any{"width": size.width, "height": size.height}
|
||||
for _, payload := range []map[string]any{dimensions, {"settings": dimensions}, {"input": dimensions}, {"providerPayload": dimensions}} {
|
||||
parameters := NormalizeBillingParameters(payload, Parameters{"resolution": "1K", "quality": "medium"})
|
||||
if parameters["aspectRatio"] != size.ratio {
|
||||
t.Fatalf("parameters=%#v", parameters)
|
||||
}
|
||||
quote, err := (Catalog{Rules: DefaultBillingPriceRules()}).Quote(QuoteInput{Provider: "evolink", Capability: "image.generate", ReqKey: "gpt-image-2", Source: "platform", Parameters: parameters})
|
||||
if err != nil || quote == nil || quote.StandardUnitPriceFen != 34 || quote.MarkupMultiplier != 1.2 || quote.AmountFen != 41 {
|
||||
t.Fatalf("A4 quote=%#v err=%v", quote, err)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user