feat: complete release readiness work
- consolidate API ownership and remove dead vendor code - add Stripe billing, learning paths, and public CV hardening - add migration, recovery, security, audit, and browser gates
This commit is contained in:
@@ -0,0 +1,44 @@
|
||||
using System.Reflection;
|
||||
using JobTrackerApi.Services;
|
||||
using Microsoft.Extensions.Configuration;
|
||||
using Microsoft.Extensions.Hosting;
|
||||
using Microsoft.Extensions.Logging.Abstractions;
|
||||
using Moq;
|
||||
using Xunit;
|
||||
|
||||
namespace JobTrackerApi.Tests;
|
||||
|
||||
public sealed class CvExportRetentionTests
|
||||
{
|
||||
[Fact]
|
||||
public void Export_pruning_removes_only_expired_date_directories()
|
||||
{
|
||||
var root = Path.Combine(Path.GetTempPath(), $"jobtracker-export-retention-{Guid.NewGuid():N}");
|
||||
var exportsRoot = Path.Combine(root, "CvExports");
|
||||
var old = Path.Combine(exportsRoot, "20260101");
|
||||
var keep = Path.Combine(exportsRoot, "20260731");
|
||||
var unrelated = Path.Combine(exportsRoot, "manual");
|
||||
Directory.CreateDirectory(old);
|
||||
Directory.CreateDirectory(keep);
|
||||
Directory.CreateDirectory(unrelated);
|
||||
|
||||
try
|
||||
{
|
||||
var config = new ConfigurationBuilder().AddInMemoryCollection(new Dictionary<string, string?> { ["Data:Root"] = root }).Build();
|
||||
var environment = new Mock<IHostEnvironment>();
|
||||
environment.SetupGet(x => x.ContentRootPath).Returns(root);
|
||||
var exporter = new PlaywrightCvPdfExporter(new AppPaths(config, environment.Object), NullLogger<PlaywrightCvPdfExporter>.Instance, config);
|
||||
var prune = typeof(PlaywrightCvPdfExporter).GetMethod("PruneExpiredExports", BindingFlags.Instance | BindingFlags.NonPublic)!;
|
||||
|
||||
prune.Invoke(exporter, [new DateOnly(2026, 7, 1)]);
|
||||
|
||||
Assert.False(Directory.Exists(old));
|
||||
Assert.True(Directory.Exists(keep));
|
||||
Assert.True(Directory.Exists(unrelated));
|
||||
}
|
||||
finally
|
||||
{
|
||||
if (Directory.Exists(root)) Directory.Delete(root, recursive: true);
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user