diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml
index 6dda553..37dc3c1 100644
--- a/.github/workflows/test.yml
+++ b/.github/workflows/test.yml
@@ -19,8 +19,8 @@ jobs:
APPCONFIG__HOLIDAYURL: ${{ secrets.APPCONFIG__HOLIDAYURL }}
TEST_RESULTS_PATH: "/home/runner/work/StpFoodBlazor/StpFoodBlazor/StpFoodBlazorTest/TestResults"
TEST_ARTIFACTS_PATH: "/home/runner/work/StpFoodBlazor/StpFoodBlazor/StpFoodBlazorTest/TestArtifacts"
- MIN_LINE_COVERAGE: 87
- MIN_BRANCH_COVERAGE: 86
+ MIN_LINE_COVERAGE: 95
+ MIN_BRANCH_COVERAGE: 90
ASPNETCORE_ENVIRONMENT: "Development"
AZURE_IDENTITY_DISABLE_MULTITENANTAUTH: true
AZURE_IDENTITY_DISABLE_CP1: true
diff --git a/StpFoodBlazor/Components/Layout/Deals/UpcomingDealsNoRecords.razor b/StpFoodBlazor/Components/Layout/Deals/UpcomingDealsNoRecords.razor
new file mode 100644
index 0000000..5ed2114
--- /dev/null
+++ b/StpFoodBlazor/Components/Layout/Deals/UpcomingDealsNoRecords.razor
@@ -0,0 +1,5 @@
+@inherits ComponentBase
+
+
+
No upcoming deals that are not yet active.
+
diff --git a/StpFoodBlazor/Components/Layout/GiftCards/GiftCardsNoRecords.razor b/StpFoodBlazor/Components/Layout/GiftCards/GiftCardsNoRecords.razor
index 770606f..0b9812a 100644
--- a/StpFoodBlazor/Components/Layout/GiftCards/GiftCardsNoRecords.razor
+++ b/StpFoodBlazor/Components/Layout/GiftCards/GiftCardsNoRecords.razor
@@ -1,4 +1,4 @@
-@inherits LayoutComponentBase
+@inherits ComponentBase
No active gift card deals. These deals are most common in May/June and December.
diff --git a/StpFoodBlazor/Components/Pages/UpcomingDeals.razor b/StpFoodBlazor/Components/Pages/UpcomingDeals.razor
index 62d6d18..0d953d4 100644
--- a/StpFoodBlazor/Components/Pages/UpcomingDeals.razor
+++ b/StpFoodBlazor/Components/Pages/UpcomingDeals.razor
@@ -19,7 +19,14 @@
}
else
{
+ @if (deals.Length == 0)
+ {
+
+ }
+ else
+ {
+ }
}
diff --git a/StpFoodBlazor/StpFoodBlazor.csproj b/StpFoodBlazor/StpFoodBlazor.csproj
index af4d7c1..ad25a43 100644
--- a/StpFoodBlazor/StpFoodBlazor.csproj
+++ b/StpFoodBlazor/StpFoodBlazor.csproj
@@ -5,7 +5,7 @@
enable
enable
true
- 0.6.0
+ 0.6.1
true
diff --git a/StpFoodBlazorTest/Pages/UpcomingDealsTest.razor b/StpFoodBlazorTest/Pages/UpcomingDealsTest.razor
new file mode 100644
index 0000000..661e565
--- /dev/null
+++ b/StpFoodBlazorTest/Pages/UpcomingDealsTest.razor
@@ -0,0 +1,65 @@
+@using Bunit
+@using Bunit.Rendering
+@using AngleSharp.Dom
+@using AngleSharp.Html.Dom
+@using StpFoodBlazor.Components.Pages
+@using StpFoodBlazor.Models
+@using StpFoodBlazor.Services
+@using StpFoodBlazorTest.Services
+
+@code {
+ private TestContext ctx;
+ private TestTimeService timeService = new TestTimeService();
+
+ public UpcomingDealsTest()
+ {
+ ctx = new TestContext();
+ ctx.Services.AddSingleton(new TestHolidayService());
+ ctx.Services.AddSingleton(timeService);
+ }
+
+ void Dispose()
+ {
+ }
+
+ [Fact]
+ public void UpcomingDealsShouldIncludeUpcomingDeals()
+ {
+ TestDealService testDealService = new TestDealService();
+ testDealService.Deals = new DealEvent[]
+ {
+ new DealEvent
+ {
+ Name = "Test Place",
+ Deal = "Test description",
+ Day = DayOfWeek.Saturday.ToString(),
+ Start = "2100-05-15"
+ }
+ };
+ ctx.Services.AddSingleton(testDealService);
+
+ var cut = ctx.Render(@);
+ var elements = getElements(cut);
+
+ Assert.Equal(1, elements.ChildElementCount);
+ }
+
+ [Fact]
+ public void UpcomingDealsShouldDisplayMessageWhenNoUpcomingDeals()
+ {
+ TestDealService testDealService = new TestDealService();
+ testDealService.NoRecords = true;
+ ctx.Services.AddSingleton(testDealService);
+
+ var cut = ctx.Render(@);
+ cut.WaitForElement("#deals_no_records", TimeSpan.FromSeconds(5));
+
+ Assert.Contains("No upcoming deals that are not yet active.", cut.Markup);
+ }
+
+ private IElement getElements(IRenderedFragment cut)
+ {
+ cut.WaitForElement("#deals_table_body", TimeSpan.FromSeconds(5));
+ return cut.Find("#deals_table_body");
+ }
+}
diff --git a/StpFoodBlazorTest/Services/TestDealService.cs b/StpFoodBlazorTest/Services/TestDealService.cs
index 55f877e..067c18c 100644
--- a/StpFoodBlazorTest/Services/TestDealService.cs
+++ b/StpFoodBlazorTest/Services/TestDealService.cs
@@ -10,9 +10,9 @@ namespace StpFoodBlazorTest.Services
public class TestDealService : IDealService
{
private static readonly string DEAL_FIXTURES_PATH = Path.Combine(Directory.GetCurrentDirectory(), "fixtures", "deals.json");
- public Boolean LongRunning { get; set; } = false;
-
+ public bool LongRunning { get; set; } = false;
public DealEvent[] Deals { get; set; } = [];
+ public bool NoRecords { get; set; } = false;
public async Task GetDealsAsync()
{
@@ -21,6 +21,11 @@ public async Task GetDealsAsync()
await Task.Delay(7000);
}
+ if (NoRecords)
+ {
+ return [];
+ }
+
if (Deals.Length > 0)
{
return Deals;
diff --git a/StpFoodBlazorTest/Services/TestGiftCardService.cs b/StpFoodBlazorTest/Services/TestGiftCardService.cs
index ca38bcd..3827959 100644
--- a/StpFoodBlazorTest/Services/TestGiftCardService.cs
+++ b/StpFoodBlazorTest/Services/TestGiftCardService.cs
@@ -10,8 +10,8 @@ namespace StpFoodBlazorTest.Services
public class TestGiftCardService : IGiftCardService
{
private static readonly string GIFTCARD_FIXTURES_PATH = Path.Combine(Directory.GetCurrentDirectory(), "fixtures", "giftcards.json");
- public Boolean LongRunning { get; set; } = false;
- public Boolean NoRecords { get; set; } = false;
+ public bool LongRunning { get; set; } = false;
+ public bool NoRecords { get; set; } = false;
public GiftCard[] Data { get; set; } = [];
public async Task GetGiftCardsAsync()