统一订单资产状态变更
This commit is contained in:
@@ -140,14 +140,29 @@ func TestCalculateDepositWaiverUsesSharedRemainingQuota(t *testing.T) {
|
||||
}
|
||||
}
|
||||
|
||||
func TestArchiveListingAfterCheckoutMovesListingOffline(t *testing.T) {
|
||||
// This test is purely for contract documentation; no behavior is tested yet.
|
||||
// When implementing auto-archive behavior:
|
||||
// - Call should succeed for renting/overdue/pending_checkout_confirm/pending_checkout_accept orders
|
||||
// - Listing status should be set to "archived" or "offline"
|
||||
// - In-transaction flag should be cleared
|
||||
// - Order should enter completed or closed state
|
||||
_ = time.Now()
|
||||
func TestArchiveAssetsMovesListingOffline(t *testing.T) {
|
||||
now := time.Now()
|
||||
listing := model.RentalListing{
|
||||
Status: listingStatusRented,
|
||||
InTransaction: true,
|
||||
PublishedAt: &now,
|
||||
}
|
||||
account := model.GameAccount{Status: accountStatusRented}
|
||||
|
||||
archiveAssets(&listing, &account)
|
||||
|
||||
if listing.Status != listingStatusOffline {
|
||||
t.Fatalf("listing.Status = %q, want %q", listing.Status, listingStatusOffline)
|
||||
}
|
||||
if listing.InTransaction {
|
||||
t.Fatal("listing.InTransaction = true, want false")
|
||||
}
|
||||
if listing.PublishedAt != nil {
|
||||
t.Fatal("listing.PublishedAt is not nil")
|
||||
}
|
||||
if account.Status != accountStatusOffline {
|
||||
t.Fatalf("account.Status = %q, want %q", account.Status, accountStatusOffline)
|
||||
}
|
||||
}
|
||||
|
||||
func TestNewOrderNoUsesShanghaiTimeWhenLocalIsUTC(t *testing.T) {
|
||||
|
||||
Reference in New Issue
Block a user