first commit

This commit is contained in:
Maksim Totmin
2026-10-01 09:50:59 +07:00
commit 4beb4b55d3
29 changed files with 3034 additions and 0 deletions
+34
View File
@@ -0,0 +1,34 @@
package lexicomai
import "testing"
func TestNormalizeProduct(t *testing.T) {
if _, err := NormalizeProduct(""); err == nil {
t.Error("empty product should error")
}
if _, err := NormalizeProduct("nope"); err == nil {
t.Error("unknown product should error")
}
p, err := NormalizeProduct("UPS")
if err != nil || p != "ups" {
t.Errorf("NormalizeProduct(UPS) = %q, %v", p, err)
}
}
func TestServiceUnit(t *testing.T) {
if got := ServiceUnit("ups"); got != "ups.service" {
t.Errorf("ServiceUnit = %q", got)
}
}
func TestDefaultProductsSorted(t *testing.T) {
ps := DefaultProducts()
if len(ps) == 0 {
t.Fatal("DefaultProducts empty")
}
for i := 1; i < len(ps); i++ {
if ps[i] < ps[i-1] {
t.Errorf("not sorted at %d: %q < %q", i, ps[i], ps[i-1])
}
}
}