feat: add BVK exchange library

This commit is contained in:
Георгий
2026-07-12 20:44:44 +03:00
parent 3a1c524eb2
commit 0ff0905a9c
15 changed files with 627 additions and 0 deletions

38
validation_test.go Normal file
View File

@@ -0,0 +1,38 @@
package mila
import "testing"
func TestValidateAcceptsValidUTF8State(t *testing.T) {
err := Validate(DefaultConfig(), ContentState{
Route: "3",
Text: "Гостиный двор - Gostiny dvor",
Template: "Гостиный двор",
})
if err != nil {
t.Fatalf("Validate returned error: %v", err)
}
}
func TestValidateRejectsTooLongRoute(t *testing.T) {
err := Validate(DefaultConfig(), ContentState{
Route: "1234",
Text: "ok",
Template: "tpl",
})
if err == nil {
t.Fatal("expected validation error")
}
if !IsValidationError(err) {
t.Fatalf("expected ValidationError, got %T", err)
}
}
func TestValidateRejectsMissingTemplate(t *testing.T) {
err := Validate(DefaultConfig(), ContentState{
Route: "3",
Text: "ok",
})
if err == nil {
t.Fatal("expected validation error")
}
}