Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 7 additions & 4 deletions JournalApp.Tests/Data/AppDataUIServiceTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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<AppDataUIService>.Instance,
appDataService,
Expand All @@ -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
{
Expand Down Expand Up @@ -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<AppDataUIService>.Instance,
appDataService,
Expand All @@ -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
Expand Down
4 changes: 2 additions & 2 deletions JournalApp.Tests/ManageCategoriesTests.razor
Original file line number Diff line number Diff line change
Expand Up @@ -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]
Expand All @@ -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]
Expand Down
Loading