32 lines
952 B
C#
32 lines
952 B
C#
using Bunit;
|
||||
|
|
using Bunit.TestDoubles;
|
|||
|
|
using Heimdall.Application.DTOs;
|
|||
|
|
using Heimdall.Web.Components.Pages;
|
|||
|
|
using Shouldly;
|
|||
|
|
|
|||
|
|
namespace Heimdall.Web.Tests.Components.Pages;
|
|||
|
|
|
|||
|
|
public sealed class NotificationsPageTests : PageTestBase
|
|||
|
|
{
|
|||
|
|
[Fact]
|
|||
|
|
public void NotificationsPage_EmptyList_ShowsEmptyState()
|
|||
|
|
{
|
|||
|
|
Handler.OnGet("api/notifications", new PagedResult<NotificationDto>([], 0, 1, 20));
|
|||
|
|
LoginAs();
|
|||
|
|
|
|||
|
|
var cut = RenderPage<NotificationsPage>();
|
|||
|
|
|
|||
|
|
cut.WaitForAssertion(() => cut.Markup.ShouldContain("Vous n’avez aucune notification."));
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
[Fact]
|
|||
|
|
public void NotificationsPage_ApiFailure_ShowsErrorState()
|
|||
|
|
{
|
|||
|
|
Handler.OnGet("api/notifications", System.Net.HttpStatusCode.InternalServerError);
|
|||
|
|
LoginAs();
|
|||
|
|
|
|||
|
|
var cut = RenderPage<NotificationsPage>();
|
|||
|
|
|
|||
|
|
cut.WaitForAssertion(() => cut.Markup.ShouldContain("Impossible de charger les notifications. Réessayez."));
|
|||
|
|
}
|
|||
|
|
}
|