feat(t227): query ERP directly from Go

This commit is contained in:
QiuSW
2026-07-29 10:05:25 +08:00
parent a5a61c05d0
commit a822edd1b2
10 changed files with 682 additions and 97 deletions
@@ -55,6 +55,24 @@ func TestFreightNormalizationRejectsConflictingIdentityAndInvalidTime(
}
}
func TestFreightSourceErrorCodesAreSourceNeutral(t *testing.T) {
cases := []struct {
err error
want string
}{
{domain.ErrFreightSourceNotConfigured, "ERP_NOT_CONFIGURED"},
{domain.ErrFreightSourceSessionNeeded, "ERP_SESSION_REQUIRED"},
{domain.ErrFreightSourceNotFound, "ERP_FREIGHT_NOT_FOUND"},
{domain.ErrFreightSourceProtocol, "ERP_RESPONSE_INVALID"},
{errors.New("temporary source failure"), "ERP_UNAVAILABLE"},
}
for _, testCase := range cases {
if got := freightSourceErrorCode(testCase.err); got != testCase.want {
t.Fatalf("freightSourceErrorCode(%v) = %q, want %q", testCase.err, got, testCase.want)
}
}
}
func TestFreightDateQuerySplitsIntoSevenDayWindows(t *testing.T) {
source := &recordingDateSource{}
service := &FreightService{source: source}