27 lines
697 B
Go
27 lines
697 B
Go
package tests
|
|
|
|
import (
|
|
"testing"
|
|
|
|
"github.com/yourorg/go-dw-platform/services/template-service/dto"
|
|
"github.com/yourorg/go-dw-platform/services/template-service/validator"
|
|
)
|
|
|
|
func TestValidateIngestRequest_MissingOrderID(t *testing.T) {
|
|
req := &dto.IngestRequest{CustomerID: "cust-1", Amount: 100}
|
|
|
|
err := validator.ValidateIngestRequest(req)
|
|
|
|
if err != validator.ErrMissingOrderID {
|
|
t.Fatalf("expected ErrMissingOrderID, got %v", err)
|
|
}
|
|
}
|
|
|
|
func TestValidateIngestRequest_Valid(t *testing.T) {
|
|
req := &dto.IngestRequest{OrderID: "ord-1", CustomerID: "cust-1", Amount: 100}
|
|
|
|
if err := validator.ValidateIngestRequest(req); err != nil {
|
|
t.Fatalf("expected no error, got %v", err)
|
|
}
|
|
}
|