Skip to content

armgit / peel

Public Imported from GitHub
0

Uninstall Mac apps with every file they leave behind, and see why each belongs. Free up space, fine-tune macOS, and set up Terminal.

Compare remembered answers by what they hold in the offline round's test

Țugui Dragoșc5c5efa91f00
diff --git a/PeelTests/AppLibraryTests.swift b/PeelTests/AppLibraryTests.swift
index c372a22d..dab34676 100644
--- a/PeelTests/AppLibraryTests.swift
+++ b/PeelTests/AppLibraryTests.swift
@@ -441,14 +441,19 @@ private nonisolated final class TestClock: Sendable {
#expect(await library.reveal([bundle]))
let app = try #require(library.apps.first { $0.bundleIdentifier == "org.example.fed" })
await library.checkForUpdates([app], force: true)
- let known = made.defaults.data(forKey: SettingsKey.updateMemory)
+ let remembered = { () -> [String: UpdateMemory]? in
+ made.defaults.data(forKey: SettingsKey.updateMemory).flatMap {
+ try? JSONDecoder().decode([String: UpdateMemory].self, from: $0)
+ }
+ }
+ let known = remembered()
#expect(library.shownUpdateStatus(of: app) == .upToDate)
SometimesOfflineProtocol.isOffline.withLock { $0 = true }
await library.checkForUpdates([app], force: true)
#expect(library.shownUpdateStatus(of: app) == .upToDate)
- #expect(made.defaults.data(forKey: SettingsKey.updateMemory) == known, "nothing learned, nothing put off")
+ #expect(known != nil && remembered() == known, "nothing learned, nothing put off")
}
@Test func anAppPeelNeverChecksGetsNothingFromHomebrew() async throws {