diff options
author | crupest <crupest@outlook.com> | 2020-06-14 16:34:42 +0800 |
---|---|---|
committer | crupest <crupest@outlook.com> | 2020-06-14 16:34:42 +0800 |
commit | 53a0483ef11cce939b1df2f288563c888a1d0567 (patch) | |
tree | e998f8cdaf38ccd2c4725b16386f56b7162d7942 /Timeline.Tests/IntegratedTests/FrontEndTest.cs | |
parent | 5d467d950fd4078146709470084cbfae331b8b10 (diff) | |
download | timeline-53a0483ef11cce939b1df2f288563c888a1d0567.tar.gz timeline-53a0483ef11cce939b1df2f288563c888a1d0567.tar.bz2 timeline-53a0483ef11cce939b1df2f288563c888a1d0567.zip |
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.
Diffstat (limited to 'Timeline.Tests/IntegratedTests/FrontEndTest.cs')
-rw-r--r-- | Timeline.Tests/IntegratedTests/FrontEndTest.cs | 34 |
1 files changed, 34 insertions, 0 deletions
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<Startup> 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);
+ }
+ }
+}
|