-
-
Notifications
You must be signed in to change notification settings - Fork 68
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
53fd154
commit 603b2a5
Showing
3 changed files
with
71 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
65 changes: 65 additions & 0 deletions
65
tests/LinkDotNet.Blog.UnitTests/Web/Features/SupportMe/SupportMePageTests.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,65 @@ | ||
using LinkDotNet.Blog.TestUtilities; | ||
using LinkDotNet.Blog.Web.Features.Components; | ||
using LinkDotNet.Blog.Web.Features.SupportMe; | ||
using LinkDotNet.Blog.Web.Features.SupportMe.Components; | ||
using Microsoft.Extensions.DependencyInjection; | ||
using Microsoft.Extensions.Options; | ||
|
||
namespace LinkDotNet.Blog.UnitTests.Web.Features.SupportMe; | ||
|
||
public class SupportMePageTests : BunitContext | ||
{ | ||
[Fact] | ||
public void ShouldRenderSupportMePage() | ||
{ | ||
Services.AddScoped(_ => Options.Create(new ProfileInformationBuilder().Build())); | ||
var supportMe = new SupportMeConfigurationBuilder() | ||
.WithShowSupportMePage() | ||
.WithSupportMePageDescription("**FooBar**") | ||
.Build(); | ||
Services.AddScoped(_ => Options.Create(supportMe)); | ||
|
||
var cut = Render<SupportMePage>(); | ||
|
||
cut.HasComponent<DonationSection>().ShouldBeTrue(); | ||
cut.Find(".container > div").TextContent.ShouldContain("FooBar"); | ||
} | ||
|
||
[Fact] | ||
public void PageDescriptionCanHandleMarkup() | ||
{ | ||
Services.AddScoped(_ => Options.Create(new ProfileInformationBuilder().Build())); | ||
var supportMe = new SupportMeConfigurationBuilder() | ||
.WithShowSupportMePage() | ||
.WithSupportMePageDescription("**FooBar**") | ||
.Build(); | ||
Services.AddScoped(_ => Options.Create(supportMe)); | ||
|
||
var cut = Render<SupportMePage>(); | ||
|
||
cut.Find(".container > div").InnerHtml.ShouldContain("<strong>FooBar</strong>"); | ||
} | ||
|
||
[Fact] | ||
public void ShouldSetOgDataForSupportPage() | ||
{ | ||
var profile = new ProfileInformationBuilder() | ||
.WithName("LinkDotNet") | ||
.Build(); | ||
Services.AddScoped(_ => Options.Create(profile)); | ||
var supportMe = new SupportMeConfigurationBuilder() | ||
.WithShowSupportMePage() | ||
.Build(); | ||
Services.AddScoped(_ => Options.Create(supportMe)); | ||
|
||
var cut = Render<SupportMePage>(); | ||
|
||
var ogData = cut.FindComponent<OgData>(); | ||
ogData.Instance.Title.ShouldBe("Support Me - LinkDotNet"); | ||
ogData.Instance.Description.ShouldBe("Support Me - LinkDotNet"); | ||
ogData.Instance.Keywords.ShouldNotBeNull(); | ||
ogData.Instance.Keywords.ShouldContain("Support"); | ||
ogData.Instance.Keywords.ShouldContain("Donation"); | ||
ogData.Instance.Keywords.ShouldContain("LinkDotNet"); | ||
} | ||
} |