Falls back to the unstyled application views when a theme template is missing

This commit is contained in:
BinaryAlley committed 2026-08-29 13:11:16 +03:00
1 parent f4b90a5aea
commit 3192b9c585
11 files changed
+366 -301

No files matched your search

@@ -275,6 +275,26 @@ public class ThemeDetectionSyncJobTests : IDisposable
await _mockUnitOfWork.Received(1).SaveChangesAsync(Arg.Any<CancellationToken>());
}
[Fact]
public async Task StartAsync_WhenRestoringBundledThemeThrows_ShouldNotCrashTheJob()
{
// Arrange
ThemeEntity brokenTheme = _themeEntityFixture.Create(themeId: "bundled-theme", installSource: ThemeInstallSource.Bundled, isDeleted: false);
_mockThemeRepository.GetAllAsync(Arg.Any<CancellationToken>()).Returns(Result.From<IEnumerable<ThemeEntity>>([brokenTheme]));
_mockThemeService.HasThemePack("bundled-theme").Returns(false);
_mockThemeService.GetBundledThemeArchivePaths().Returns([]);
_mockThemeService.RestoreBundledThemeAsync("bundled-theme", Arg.Any<CancellationToken>())
.Returns(Task.FromException<Result<Success>>(new IOException("The theme storage is locked.")));
_mockThemeRepository.UpdateAsync(Arg.Any<ThemeEntity>(), Arg.Any<CancellationToken>()).Returns(Result.From(Result.Updated));
// Act
await StartAndWaitForExecutionAsync(CreateSut());
// Assert
await _mockThemeService.Received(1).RestoreBundledThemeAsync("bundled-theme", Arg.Any<CancellationToken>());
await _mockUnitOfWork.Received(1).SaveChangesAsync(Arg.Any<CancellationToken>());
}
[Fact]
public async Task StartAsync_WhenLastBundledThemePackCannotBeRestored_ShouldKeepAndActivateTheTheme()
{