修复完成订单自动回显
This commit is contained in:
@@ -2,6 +2,7 @@ package order
|
||||
|
||||
import (
|
||||
"testing"
|
||||
"time"
|
||||
|
||||
"hfb_sys/backend/internal/model"
|
||||
|
||||
@@ -112,3 +113,30 @@ func TestCalculateCheckoutSettlementAddsDepositCompensation(t *testing.T) {
|
||||
t.Fatalf("RenterRefund = %.2f, want 120.00", settlement.RenterRefund)
|
||||
}
|
||||
}
|
||||
|
||||
func TestArchiveListingAfterCheckoutMovesListingOffline(t *testing.T) {
|
||||
now := time.Now()
|
||||
listing := model.RentalListing{
|
||||
Status: "published",
|
||||
InTransaction: true,
|
||||
PublishedAt: &now,
|
||||
}
|
||||
account := model.GameAccount{
|
||||
Status: "published",
|
||||
}
|
||||
|
||||
archiveListingAfterCheckout(&listing, &account)
|
||||
|
||||
if listing.Status != "offline" {
|
||||
t.Fatalf("listing status = %q, want offline", listing.Status)
|
||||
}
|
||||
if listing.InTransaction {
|
||||
t.Fatal("listing in_transaction should be false")
|
||||
}
|
||||
if listing.PublishedAt != nil {
|
||||
t.Fatal("listing published_at should be nil")
|
||||
}
|
||||
if account.Status != "offline" {
|
||||
t.Fatalf("account status = %q, want offline", account.Status)
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user