38 lines
1.2 KiB
C#
38 lines
1.2 KiB
C#
using Elternbeirat.Web.Features.Home;
|
|
using Elternbeirat.Web.Shared;
|
|
|
|
namespace Elternbeirat.Web.Tests;
|
|
|
|
/// <summary>
|
|
/// Unit tests for the slug-to-icon mapping of the home page tiles. Pure logic, no
|
|
/// PocketBase needed.
|
|
/// </summary>
|
|
public class TileIconsTests
|
|
{
|
|
[Theory]
|
|
[InlineData("board", "users")]
|
|
[InlineData("faqs", "help-circle")]
|
|
[InlineData("events", "calendar")]
|
|
public void Known_slug_gets_its_icon(string slug, string icon) =>
|
|
TileIcons.For(slug).ShouldBe(icon);
|
|
|
|
[Theory]
|
|
[InlineData("schulweg")] // a page an editor just created
|
|
[InlineData("Board")] // slugs are lowercase; anything else is unknown
|
|
[InlineData("")]
|
|
public void Unknown_slug_gets_the_default_icon(string slug) =>
|
|
TileIcons.For(slug).ShouldBe(TileIcons.Default);
|
|
|
|
[Theory]
|
|
[InlineData("board")]
|
|
[InlineData("patrons")]
|
|
[InlineData("faqs")]
|
|
[InlineData("downloads")]
|
|
[InlineData("posts")]
|
|
[InlineData("events")]
|
|
[InlineData("contact")]
|
|
[InlineData("unbekannt")] // the default
|
|
public void Every_icon_exists_in_the_icon_set(string slug) =>
|
|
IconSet.Find(TileIcons.For(slug)).ShouldNotBeNull(); // a typo would render no icon at all
|
|
}
|