File tree Expand file tree Collapse file tree 1 file changed +23
-0
lines changed
tests/LinkDotNet.Blog.IntegrationTests/Web/Features/ShowBlogPost Expand file tree Collapse file tree 1 file changed +23
-0
lines changed Original file line number Diff line number Diff line change @@ -75,6 +75,29 @@ public async Task ShouldSetTagsWhenAvailable()
75
75
ogData . Instance . Keywords . Should ( ) . Be ( "Tag1,Tag2" ) ;
76
76
}
77
77
78
+ [ Fact ]
79
+ public async Task ShouldSetStructuredData ( )
80
+ {
81
+ var post = new BlogPostBuilder ( )
82
+ . WithTitle ( "Title" )
83
+ . WithPreviewImageUrl ( "image1" )
84
+ . WithPreviewImageUrlFallback ( "image2" )
85
+ . Build ( ) ;
86
+ await Repository . StoreAsync ( post ) ;
87
+ using var ctx = new TestContext ( ) ;
88
+ ctx . JSInterop . Mode = JSRuntimeMode . Loose ;
89
+ ctx . AddTestAuthorization ( ) ;
90
+ RegisterComponents ( ctx ) ;
91
+ var cut = ctx . RenderComponent < ShowBlogPostPage > (
92
+ p => p . Add ( b => b . BlogPostId , post . Id ) ) ;
93
+
94
+ var structuredData = cut . FindComponent < StructuredData > ( ) ;
95
+
96
+ structuredData . Instance . Headline . Should ( ) . Be ( "Title" ) ;
97
+ structuredData . Instance . PreviewImage . Should ( ) . Be ( "image1" ) ;
98
+ structuredData . Instance . PreviewFallbackImage . Should ( ) . Be ( "image2" ) ;
99
+ }
100
+
78
101
private void RegisterComponents ( TestContextBase ctx , ILocalStorageService localStorageService = null )
79
102
{
80
103
ctx . Services . AddScoped ( _ => Repository ) ;
You can’t perform that action at this time.
0 commit comments