feat: add blog feed (#3)
* chore: begin working on post service * chore: add debug assets * chore: add whitelist words * feat: add prism for syntax highlighting * feat: updated favicon * feat: add blog feed * fix: add link to written by image * feat: add custom error pages * fix: focus on h2 since h1 is always the journal site title * feat: use status code pages with redirects * fix: add discernible text to link * feat: add support for light and dark theme * fix: wrap body with main tag * fix: style main element in pages to take up full width of container * fix: add heading to home page * feat: add not-found-corgi image * chore: add robots.txt file * chore: clean up place holder posts * fix: namespace header in layouts * fix: use logger instead of console * fix: use new text context in each test when registering services * chore: update workflow to debug failing tests * chore: install playwright deps * fix: extend expect timeout * fix: extend expect timeout * fix: capture traces * fix: capture traces * fix: index file name
This commit is contained in:
@@ -1,6 +1,10 @@
|
||||
using Blog.Posts;
|
||||
|
||||
using Microsoft.AspNetCore.Hosting.Server.Features;
|
||||
using Microsoft.AspNetCore.Http.Features;
|
||||
using Microsoft.AspNetCore.TestHost;
|
||||
using Microsoft.Extensions.Logging;
|
||||
using Microsoft.Extensions.Options;
|
||||
|
||||
namespace Blog.Tests.EndToEnd;
|
||||
|
||||
@@ -31,13 +35,18 @@ public class BlogHostFactory<TProgram> : WebApplicationFactory<TProgram> where T
|
||||
}
|
||||
|
||||
protected override IHost CreateHost(IHostBuilder builder)
|
||||
{
|
||||
{
|
||||
var testHost = builder
|
||||
.ConfigureWebHost(
|
||||
webHostBuilder => webHostBuilder.ConfigureLogging(
|
||||
config => config.ClearProviders()
|
||||
)
|
||||
)
|
||||
.ConfigureWebHost(webHostBuilder =>
|
||||
{
|
||||
webHostBuilder.ConfigureLogging(config => config.ClearProviders());
|
||||
webHostBuilder.ConfigureTestServices(services =>
|
||||
{
|
||||
var postsDirectory = Path.Combine(Directory.GetCurrentDirectory(), "TestPosts");
|
||||
var postServiceOptions = new FilePostServiceOptions() { PostsDirectory = postsDirectory };
|
||||
services.AddSingleton(Options.Create(postServiceOptions));
|
||||
});
|
||||
})
|
||||
.Build();
|
||||
|
||||
builder.ConfigureWebHost(
|
||||
@@ -46,17 +55,17 @@ public class BlogHostFactory<TProgram> : WebApplicationFactory<TProgram> where T
|
||||
)
|
||||
);
|
||||
|
||||
_host = builder.Build();
|
||||
_host.Start();
|
||||
_host = builder.Build();
|
||||
_host.Start();
|
||||
|
||||
var server = _host.Services.GetRequiredService<IServer>();
|
||||
var addresses = server.Features.GetRequiredFeature<IServerAddressesFeature>();
|
||||
var server = _host.Services.GetRequiredService<IServer>();
|
||||
var addresses = server.Features.GetRequiredFeature<IServerAddressesFeature>();
|
||||
|
||||
ClientOptions.BaseAddress = addresses.Addresses
|
||||
.Select(x => new Uri(x))
|
||||
ClientOptions.BaseAddress = addresses.Addresses
|
||||
.Select(x => new Uri(x))
|
||||
.Last();
|
||||
|
||||
testHost.Start();
|
||||
return testHost;
|
||||
testHost.Start();
|
||||
return testHost;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user