Files
go-cart-actor/pkg/order/tax_test.go
T
mats aa8b2bdedc
Build and Publish / BuildAndDeployAmd64 (push) Failing after 5s
Build and Publish / BuildAndDeployArm64 (push) Failing after 6s
all the refactor
2026-06-28 17:51:52 +02:00

35 lines
886 B
Go

package order
import (
"testing"
)
// TestReExports verifies that the order package's type aliases and
// forwarders to pkg/cart compile and work correctly.
func TestReExports(t *testing.T) {
// Type alias: TaxProvider = cart.TaxProvider
var _ TaxProvider = NewNordicTaxProvider("SE")
var _ TaxProvider = NewStaticTaxProvider()
// NordicTaxProvider
p := NewNordicTaxProvider("SE")
if p.Name() != "nordic" {
t.Errorf("Name = %q", p.Name())
}
if got := p.DefaultTaxRate("SE"); got != 2500 {
t.Errorf("DefaultTaxRate(SE) = %d, want 2500", got)
}
if got := ComputeTax(1250, 2500); got != 250 {
t.Errorf("ComputeTax(1250, 2500) = %d, want 250", got)
}
// StaticTaxProvider
s := NewStaticTaxProvider()
if s.Name() != "static" {
t.Errorf("Name = %q", s.Name())
}
if got := s.DefaultTaxRate("SE"); got != 0 {
t.Errorf("DefaultTaxRate(SE) = %d, want 0", got)
}
}