test(ypp): keep upload window fixture current

This commit is contained in:
2026-11-02 11:10:21 -08:00
parent 9fa06c67c2
commit 3985a413a7
2 changed files with 19 additions and 17 deletions
+8 -5
View File
@@ -40,6 +40,9 @@ public class ChannelStatsServiceTests
[Fact]
public async Task CaptureCurrent_RequestsNoAuditDetails_AndStillParsesTheSnapshot()
{
var recentUpload = DateTime.UtcNow.AddDays(-10).ToString("O");
var olderUpload = DateTime.UtcNow.AddDays(-80).ToString("O");
var outsideWindow = DateTime.UtcNow.AddDays(-100).ToString("O");
var auth = new YouTubeAuthService("test-client", "test-secret");
auth.SetSession(new Models.YouTubeChannel
{
@@ -55,11 +58,11 @@ public class ChannelStatsServiceTests
{"items":[{"id":"UC-1","statistics":{"subscriberCount":"350","viewCount":"12345","videoCount":"42"},
"contentDetails":{"relatedPlaylists":{"uploads":"UPL"}}}]}
"""
: """
: $$$$"""
{"items":[
{"snippet":{"publishedAt":"2026-08-01T00:00:00Z"}},
{"snippet":{"publishedAt":"2026-09-01T00:00:00Z"}},
{"snippet":{"publishedAt":"2025-01-01T00:00:00Z"}}
{"snippet":{"publishedAt":"{{{{recentUpload}}}}"}},
{"snippet":{"publishedAt":"{{{{olderUpload}}}}"}},
{"snippet":{"publishedAt":"{{{{outsideWindow}}}}"}}
]}
""",
};
@@ -81,4 +84,4 @@ public class ChannelStatsServiceTests
Assert.Equal(2, snapshot.UploadsLast90Days);
Assert.False(DateTime.UtcNow - snapshot.CapturedAtUtc > TimeSpan.FromMinutes(1));
}
}
}