File tree 2 files changed +6
-5
lines changed
LinkDotNet.Blog.IntegrationTests/Web/Pages
LinkDotNet.Blog.Web/Shared 2 files changed +6
-5
lines changed Original file line number Diff line number Diff line change @@ -46,8 +46,9 @@ public async Task ShouldSubtractLikeOnEvent()
46
46
await Repository . StoreAsync ( publishedPost ) ;
47
47
using var ctx = new TestContext ( ) ;
48
48
var localStorage = new Mock < ILocalStorageService > ( ) ;
49
- localStorage . Setup ( l => l . ContainKeyAsync ( "hasLiked" , default ) ) . ReturnsAsync ( true ) ;
50
- localStorage . Setup ( l => l . GetItemAsync < bool > ( "hasLiked" , default ) ) . ReturnsAsync ( true ) ;
49
+ var hasLikedStorage = $ "hasLiked/{ publishedPost . Id } ";
50
+ localStorage . Setup ( l => l . ContainKeyAsync ( hasLikedStorage , default ) ) . ReturnsAsync ( true ) ;
51
+ localStorage . Setup ( l => l . GetItemAsync < bool > ( hasLikedStorage , default ) ) . ReturnsAsync ( true ) ;
51
52
ctx . JSInterop . Mode = JSRuntimeMode . Loose ;
52
53
RegisterComponents ( ctx , localStorage . Object ) ;
53
54
ctx . AddTestAuthorization ( ) . SetAuthorized ( "s" ) ;
Original file line number Diff line number Diff line change 42
42
43
43
HasLiked = ! HasLiked ;
44
44
await OnBlogPostLiked .InvokeAsync (HasLiked );
45
- await localStorage .SetItemAsync (" hasLiked" , HasLiked );
45
+ await localStorage .SetItemAsync ($ " hasLiked/{ BlogPost . Id } " , HasLiked );
46
46
}
47
47
48
48
private async Task <bool > GetHasLiked ()
49
49
{
50
- if (await localStorage .ContainKeyAsync (" hasLiked" ))
50
+ if (await localStorage .ContainKeyAsync ($ " hasLiked/{ BlogPost . Id } " ))
51
51
{
52
- return await localStorage .GetItemAsync <bool >(" hasLiked" );
52
+ return await localStorage .GetItemAsync <bool >($ " hasLiked/{ BlogPost . Id } " );
53
53
}
54
54
55
55
return false ;
You can’t perform that action at this time.
0 commit comments