diff --git a/LittleShop.Tests/Infrastructure/TestWebApplicationFactory.cs b/LittleShop.Tests/Infrastructure/TestWebApplicationFactory.cs index 5d6ff97..9a0f589 100644 --- a/LittleShop.Tests/Infrastructure/TestWebApplicationFactory.cs +++ b/LittleShop.Tests/Infrastructure/TestWebApplicationFactory.cs @@ -85,6 +85,8 @@ public class TestWebApplicationFactory : WebApplicationFactory services.TryAddScoped(); services.TryAddScoped(); services.TryAddScoped(); + services.TryAddScoped(); + services.TryAddScoped(); // Add validation service services.TryAddSingleton(); diff --git a/LittleShop/Program.cs b/LittleShop/Program.cs index a173800..60125bd 100644 --- a/LittleShop/Program.cs +++ b/LittleShop/Program.cs @@ -131,7 +131,7 @@ builder.Services.AddSingleton\""); } +// Use test key for testing environment +if (builder.Environment.EnvironmentName == "Testing" && string.IsNullOrEmpty(jwtKey)) +{ + jwtKey = "test-key-that-is-at-least-32-characters-long-for-security"; +} + var jwtIssuer = builder.Configuration["Jwt:Issuer"] ?? "LittleShop"; var jwtAudience = builder.Configuration["Jwt:Audience"] ?? "LittleShop";