Bootstrap copied BFF and local accounts with public Sendico contracts (#34)
This commit is contained in:
1 parent
67dc5b5b1e
commit
7062672a87
556 files changed
+42291
-777
No files matched your search
@@ -0,0 +1,37 @@
|
||||
package merrors
|
||||
|
||||
import (
|
||||
"errors"
|
||||
"testing"
|
||||
)
|
||||
|
||||
func TestDocumentsReportOwnedReasonRoundTrip(t *testing.T) {
|
||||
err := DocumentsReportOwned("report has an active payout")
|
||||
if !errors.Is(err, ErrDataConflict) || !errors.Is(err, ErrDocumentsReportOwned) {
|
||||
t.Fatalf("DocumentsReportOwned() classification = %v", err)
|
||||
}
|
||||
reason, ok := Reason(err)
|
||||
if !ok || reason != ReasonDocumentsReportOwned {
|
||||
t.Fatalf("Reason() = %q, %t", reason, ok)
|
||||
}
|
||||
restored, ok := FromReason(reason, "report has an active payout")
|
||||
if !ok || !errors.Is(restored, ErrDataConflict) || !errors.Is(restored, ErrDocumentsReportOwned) {
|
||||
t.Fatalf("FromReason() = %v, %t", restored, ok)
|
||||
}
|
||||
}
|
||||
|
||||
func TestDocumentsQuotationExpiredReasonRoundTrip(t *testing.T) {
|
||||
err := DocumentsQuotationExpired("quotation expired")
|
||||
if !errors.Is(err, ErrFailedPrecondition) || !errors.Is(err, ErrDocumentsQuotationExpired) {
|
||||
t.Fatalf("DocumentsQuotationExpired() classification = %v", err)
|
||||
}
|
||||
reason, ok := Reason(err)
|
||||
if !ok || reason != ReasonDocumentsQuotationExpired {
|
||||
t.Fatalf("Reason() = %q, %t", reason, ok)
|
||||
}
|
||||
restored, ok := FromReason(reason, "quotation expired")
|
||||
if !ok || !errors.Is(restored, ErrFailedPrecondition) ||
|
||||
!errors.Is(restored, ErrDocumentsQuotationExpired) {
|
||||
t.Fatalf("FromReason() = %v, %t", restored, ok)
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user