From 4ae7ea04ba5de5ce508b9e9da9dae1636a25448f Mon Sep 17 00:00:00 2001 From: Cy Okeke Date: Wed, 21 Jan 2026 21:50:38 +0100 Subject: [PATCH] Fix the subscribe unit test --- test/Core.Test/Billing/Services/SubscriberServiceTests.cs | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/test/Core.Test/Billing/Services/SubscriberServiceTests.cs b/test/Core.Test/Billing/Services/SubscriberServiceTests.cs index 9a6c6f8bd8..ec1d508820 100644 --- a/test/Core.Test/Billing/Services/SubscriberServiceTests.cs +++ b/test/Core.Test/Billing/Services/SubscriberServiceTests.cs @@ -165,7 +165,8 @@ public class SubscriberServiceTests var subscription = new Subscription { Id = subscriptionId, - Status = "active" + Status = "active", + Metadata = new Dictionary() }; var stripeAdapter = sutProvider.GetDependency(); @@ -215,6 +216,8 @@ public class SubscriberServiceTests GatewaySubscriptionId = null }; + var previousPeriodEndDate = DateTime.UtcNow.AddMonths(1); + var subscription = new Subscription { Id = "sub_test", @@ -232,7 +235,7 @@ public class SubscriberServiceTests [StripeConstants.MetadataKeys.PreviousPremiumPriceId] = "premium-annually-2020", [StripeConstants.MetadataKeys.UpgradedOrganizationId] = organization.Id.ToString(), [StripeConstants.MetadataKeys.PreviousPremiumUserId] = userId.ToString(), - [StripeConstants.MetadataKeys.PreviousPeriodEndDate] = DateTime.UtcNow.AddMonths(1).ToString("O"), + [StripeConstants.MetadataKeys.PreviousPeriodEndDate] = previousPeriodEndDate.ToString("O"), [StripeConstants.MetadataKeys.PreviousAdditionalStorage] = "5", [StripeConstants.MetadataKeys.PreviousStoragePriceId] = "storage-annually-2020", [StripeConstants.MetadataKeys.OrganizationId] = organization.Id.ToString() @@ -280,7 +283,6 @@ public class SubscriberServiceTests opts.Items.Count(i => i.Deleted == true) == 1 && opts.Items.Any(i => i.Price == "premium-annually-2020" && i.Quantity == 1) && opts.Items.Any(i => i.Price == "storage-annually-2020" && i.Quantity == 5) && - opts.TrialEnd.Value == SubscriptionTrialEnd.Now && opts.Metadata[StripeConstants.MetadataKeys.UserId] == userId.ToString() && !opts.Metadata.ContainsKey(StripeConstants.MetadataKeys.PreviousPremiumPriceId) && !opts.Metadata.ContainsKey(StripeConstants.MetadataKeys.OrganizationId)));