Skip to content

Commit

Permalink
Fixed Tests
Browse files Browse the repository at this point in the history
  • Loading branch information
linkdotnet committed Jul 14, 2021
1 parent 3ae9b51 commit 4101283
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@ public async Task ShouldOnlyShowPublishedPosts()
var cut = ctx.RenderComponent<DraftBlogPosts>();
cut.WaitForState(() => cut.FindAll(".blog-card").Any());


var blogPosts = cut.FindComponents<ShortBlogPost>();

blogPosts.Should().HaveCount(1);
Expand Down
4 changes: 3 additions & 1 deletion LinkDotNet.Blog.IntegrationTests/Web/Pages/IndexTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -100,11 +100,13 @@ public async Task ShouldLoadPreviousBatchOnClick()
var cut = ctx.RenderComponent<Index>();
cut.WaitForState(() => cut.FindAll(".blog-card").Any());
cut.FindComponent<BlogPostNavigation>().Find("li:last-child a").Click();
cut.WaitForState(() => cut.FindAll(".blog-card").Count == 1);

cut.FindComponent<BlogPostNavigation>().Find("li:first-child a").Click();

cut.WaitForState(() => cut.FindAll(".blog-card").Count > 1);
var blogPosts = cut.FindComponents<ShortBlogPost>();
blogPosts.Count.Should().Be(1);
blogPosts.Count.Should().Be(10);
}

private static AppConfiguration CreateSampleAppConfiguration()
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
using System;
using System.Linq;
using System.Threading.Tasks;
using Bunit;
using FluentAssertions;
Expand All @@ -21,6 +22,7 @@ public async Task ShouldOnlyDisplayTagsGivenByParameter()
await AddBlogPostWithTagAsync("Tag 2");
ctx.Services.AddScoped<IRepository>(_ => BlogPostRepository);
var cut = ctx.RenderComponent<SearchByTag>(p => p.Add(s => s.Tag, "Tag 1"));
cut.WaitForState(() => cut.FindAll(".blog-card").Any());

var tags = cut.FindAll(".blog-card");

Expand All @@ -34,6 +36,7 @@ public async Task ShouldHandleSpecialCharacters()
await AddBlogPostWithTagAsync("C#");
ctx.Services.AddScoped<IRepository>(_ => BlogPostRepository);
var cut = ctx.RenderComponent<SearchByTag>(p => p.Add(s => s.Tag, Uri.EscapeDataString("C#")));
cut.WaitForState(() => cut.FindAll(".blog-card").Any());

var tags = cut.FindAll(".blog-card");

Expand Down

0 comments on commit 4101283

Please sign in to comment.