From 5e02abc95cc8419b378917d7053d63092046b2cf Mon Sep 17 00:00:00 2001 From: crupest Date: Sun, 14 Jun 2020 16:34:42 +0800 Subject: Many many bugs fix. 1. Add a way to test front end with mock page. 2. Unknown api returns 400 but not frontend page. 3. Fix a big bug that cause all data loss in database migration. --- Timeline.Tests/IntegratedTests/FrontEndTest.cs | 34 ++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) create mode 100644 Timeline.Tests/IntegratedTests/FrontEndTest.cs (limited to 'Timeline.Tests/IntegratedTests/FrontEndTest.cs') diff --git a/Timeline.Tests/IntegratedTests/FrontEndTest.cs b/Timeline.Tests/IntegratedTests/FrontEndTest.cs new file mode 100644 index 00000000..a00d41b1 --- /dev/null +++ b/Timeline.Tests/IntegratedTests/FrontEndTest.cs @@ -0,0 +1,34 @@ +using FluentAssertions; +using Microsoft.AspNetCore.Mvc.Testing; +using System.Net.Mime; +using System.Threading.Tasks; +using Timeline.Tests.Helpers; +using Xunit; + +namespace Timeline.Tests.IntegratedTests +{ + public class FrontEndTest : IntegratedTestBase + { + public FrontEndTest(WebApplicationFactory factory) : base(factory) + { + } + + [Fact] + public async Task Index() + { + using var client = await CreateDefaultClient(false); + var res = await client.GetAsync("index.html"); + res.Should().HaveStatusCode(200); + res.Content.Headers.ContentType.MediaType.Should().Be(MediaTypeNames.Text.Html); + } + + [Fact] + public async Task Fallback() + { + using var client = await CreateDefaultClient(false); + var res = await client.GetAsync("aaaaaaaaaaaaaaa"); + res.Should().HaveStatusCode(200); + res.Content.Headers.ContentType.MediaType.Should().Be(MediaTypeNames.Text.Html); + } + } +} -- cgit v1.2.3