fux
This commit is contained in:
1 parent
fd83a7c523
commit
edbbf127ba
12 files changed
+246
-207
No files matched your search
@@ -9,12 +9,12 @@ func TestContentDebitUnits(t *testing.T) {
|
||||
processingType string
|
||||
want int64
|
||||
}{
|
||||
{[]string{"title"}, "title", 1000},
|
||||
{[]string{"title", "description"}, "enhance", 3500},
|
||||
{[]string{"title", "description", "seo_meta"}, "enhance", 4500},
|
||||
{[]string{"seo_meta"}, "seo_meta", 1000},
|
||||
{[]string{"title", "title"}, "title", 1000},
|
||||
{nil, "description", 2500},
|
||||
{[]string{"title"}, "title", 10000},
|
||||
{[]string{"title", "description"}, "enhance", 10000},
|
||||
{[]string{"title", "description", "seo_meta"}, "enhance", 10000},
|
||||
{[]string{"seo_meta"}, "seo_meta", 10000},
|
||||
{[]string{"title", "title"}, "title", 10000},
|
||||
{nil, "description", 10000},
|
||||
}
|
||||
for _, tt := range cases {
|
||||
got, err := ContentDebitUnits(tt.selected, tt.processingType, rates)
|
||||
@@ -27,12 +27,12 @@ func TestContentDebitUnits(t *testing.T) {
|
||||
}
|
||||
for _, outputs := range [][]string{nil, {"title"}, {"title", "description", "seo_meta"}} {
|
||||
got, err := ContentDebitUnits(outputs, "enhance", map[string]int64{"title": 1000, "description": 2500, "seo_meta": 1000, "product": 3750})
|
||||
if err != nil || got != 3750 {
|
||||
if err != nil || got != 10000 {
|
||||
t.Errorf("per-product price outputs=%v got=%d err=%v", outputs, got, err)
|
||||
}
|
||||
}
|
||||
zero, err := ContentDebitUnits([]string{"title"}, "title", map[string]int64{"title": 0})
|
||||
if err != nil || zero != 0 {
|
||||
if err != nil || zero != 10000 {
|
||||
t.Fatalf("zero cost %v %v", zero, err)
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user