1
0
mirror of https://github.com/bitwarden/server.git synced 2025-01-09 19:57:37 +01:00

[PM-16611] Failing unit tests due to previous month being incorrectly… (#5207)

This commit is contained in:
Jonas Hendrickx 2025-01-02 16:07:34 +01:00 committed by GitHub
parent bc40884db0
commit bad533af8e
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -260,13 +260,15 @@ public class ProviderBillingControllerTests
var stripeAdapter = sutProvider.GetDependency<IStripeAdapter>();
var (thisYear, thisMonth, _) = DateTime.UtcNow;
var daysInThisMonth = DateTime.DaysInMonth(thisYear, thisMonth);
var now = DateTime.UtcNow;
var oneMonthAgo = now.AddMonths(-1);
var daysInThisMonth = DateTime.DaysInMonth(now.Year, now.Month);
var subscription = new Subscription
{
CollectionMethod = StripeConstants.CollectionMethod.ChargeAutomatically,
CurrentPeriodEnd = new DateTime(thisYear, thisMonth, daysInThisMonth),
CurrentPeriodEnd = new DateTime(now.Year, now.Month, daysInThisMonth),
Customer = new Customer
{
Address = new Address
@ -290,15 +292,14 @@ public class ProviderBillingControllerTests
options.Expand.Contains("customer.tax_ids") &&
options.Expand.Contains("test_clock"))).Returns(subscription);
var lastMonth = thisMonth - 1;
var daysInLastMonth = DateTime.DaysInMonth(thisYear, lastMonth);
var daysInLastMonth = DateTime.DaysInMonth(oneMonthAgo.Year, oneMonthAgo.Month);
var overdueInvoice = new Invoice
{
Id = "invoice_id",
Status = "open",
Created = new DateTime(thisYear, lastMonth, 1),
PeriodEnd = new DateTime(thisYear, lastMonth, daysInLastMonth),
Created = new DateTime(oneMonthAgo.Year, oneMonthAgo.Month, 1),
PeriodEnd = new DateTime(oneMonthAgo.Year, oneMonthAgo.Month, daysInLastMonth),
Attempted = true
};