From 4e7df2bed984c2af28d14be0a22ba987a970d55b Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Thu, 7 May 2026 15:40:49 +0000 Subject: [PATCH] Update failing tests for current import flow Agent-Logs-Url: https://github.com/danielchalmers/JournalApp/sessions/131ca7c1-a6ce-4c9c-b9bf-667eccd46f05 Co-authored-by: danielchalmers <7112040+danielchalmers@users.noreply.github.com> --- JournalApp.Tests/Data/AppDataUIServiceTests.cs | 11 +++++++---- JournalApp.Tests/ManageCategoriesTests.razor | 4 ++-- 2 files changed, 9 insertions(+), 6 deletions(-) diff --git a/JournalApp.Tests/Data/AppDataUIServiceTests.cs b/JournalApp.Tests/Data/AppDataUIServiceTests.cs index 931209e..5800ca5 100644 --- a/JournalApp.Tests/Data/AppDataUIServiceTests.cs +++ b/JournalApp.Tests/Data/AppDataUIServiceTests.cs @@ -44,7 +44,7 @@ public async Task StartImportWizard_DoesNotModifyDataOrPreferences_WhenUserCance "imported-palette"); await importBackup.WriteArchive(importPath); - var dialogService = new TestDialogService([null]); + var dialogService = new TestDialogService([true, null]); var service = new AppDataUIService( NullLogger.Instance, appDataService, @@ -70,8 +70,9 @@ public async Task StartImportWizard_DoesNotModifyDataOrPreferences_WhenUserCance preferenceService.SelectedAppTheme.Should().Be(AppTheme.Dark); preferenceService.SafetyPlan.WarningSigns.Should().Be("stay safe"); - dialogService.Messages.Should().HaveCount(1); - dialogService.Messages.Single().Should().Contain("This will replace ALL current data"); + dialogService.Messages.Should().HaveCount(2); + dialogService.Messages[0].Should().Contain("Back up your current data first"); + dialogService.Messages[1].Should().Contain("This will replace ALL current data"); } finally { @@ -121,7 +122,7 @@ public async Task StartImportWizard_DoesNotRestorePreferencesOrUpdateLastExport_ var importPath = Path.Combine(Path.GetTempPath(), $"failed-import-{Guid.NewGuid()}.journalapp"); await invalidBackup.WriteArchive(importPath); - var dialogService = new TestDialogService([true]); + var dialogService = new TestDialogService([true, true]); var service = new AppDataUIService( NullLogger.Instance, appDataService, @@ -145,6 +146,8 @@ public async Task StartImportWizard_DoesNotRestorePreferencesOrUpdateLastExport_ preferenceService.LastExportDate.Should().Be(originalExportDate); preferenceService.SafetyPlan.WarningSigns.Should().Be("original warning"); + dialogService.Messages.Should().Contain(message => message.Contains("Back up your current data first")); + dialogService.Messages.Should().Contain(message => message.Contains("This will replace ALL current data")); dialogService.Messages.Should().Contain(message => message.StartsWith("Import failed:")); } finally diff --git a/JournalApp.Tests/ManageCategoriesTests.razor b/JournalApp.Tests/ManageCategoriesTests.razor index a6ff334..f407b43 100644 --- a/JournalApp.Tests/ManageCategoriesTests.razor +++ b/JournalApp.Tests/ManageCategoriesTests.razor @@ -175,7 +175,7 @@ // Submit changes and confirm there is a new category in the list. layout.Find(".category-dialog .submit-button").Click(); - layout.FindAll(".manage-category-edit-button").Count.Should().Be(initialCount + 1); + layout.WaitForAssertion(() => layout.FindAll(".manage-category-edit-button").Count.Should().Be(initialCount + 1)); } [Fact] @@ -200,7 +200,7 @@ // Submit changes and confirm there is a new category in the list. layout.Find(".category-dialog .submit-button").Click(); - layout.FindAll(".manage-category-edit-button").Count.Should().Be(initialCount + 1); + layout.WaitForAssertion(() => layout.FindAll(".manage-category-edit-button").Count.Should().Be(initialCount + 1)); } [Fact]