Skip to content

Free, open-source Windows optimization tool for performance, privacy, and simplicity.

test(cleanup): skip the empty-bin check when the session has no shell

fatDuckd331cbab0718
diff --git a/optimizerDuck.Test/Services/OptimizationServices/RecycleBinServiceTests.cs b/optimizerDuck.Test/Services/OptimizationServices/RecycleBinServiceTests.cs
index 503e073..f716d1d 100644
--- a/optimizerDuck.Test/Services/OptimizationServices/RecycleBinServiceTests.cs
+++ b/optimizerDuck.Test/Services/OptimizationServices/RecycleBinServiceTests.cs
@@ -71,6 +71,14 @@ public class RecycleBinServiceTests
var (succeeded, errorCode) = RecycleBinService.Empty();
+ // A session without the desktop shell (a CI runner) answers the call with E_UNEXPECTED:
+ // there is nothing to empty there either, so that is an environment limit rather than a
+ // failure of the operation, and the app already reports it as "no space freed".
+ if (!succeeded && (uint)errorCode == 0x8000FFFF)
+ Assert.Skip(
+ "SHEmptyRecycleBin returned E_UNEXPECTED: no desktop shell in this session."
+ );
+
Assert.True(succeeded, $"SHEmptyRecycleBin failed with 0x{errorCode:X8}");
}