Download this file
| 1 | #if os(macOS) |
| 2 | import XCTest |
| 3 | @testable import RastrilloMacUpdates |
| 4 | |
| 5 | @MainActor final class ConfigurationTests: XCTestCase { |
| 6 | func testOnlyConfiguredHTTPSFeedWithEd25519KeyCanStart() { |
| 7 | let key = Data(repeating: 7, count: 32).base64EncodedString() |
| 8 | XCTAssertTrue(NativeUpdater.validConfiguration(["SUFeedURL": "https://raw.amadan.net/oficina/native-releases/main/docs/appcast.xml", "SUPublicEDKey": key])) |
| 9 | for feed in ["http://example.com/feed.xml", "https://token@example.com/feed.xml", "https://example.com/feed.xml#fragment", "https://"] { |
| 10 | XCTAssertFalse(NativeUpdater.validConfiguration(["SUFeedURL": feed, "SUPublicEDKey": key])) |
| 11 | } |
| 12 | XCTAssertFalse(NativeUpdater.validConfiguration([:])) |
| 13 | XCTAssertFalse(NativeUpdater.validConfiguration(["SUFeedURL": "https://example.com/feed.xml", "SUPublicEDKey": Data(repeating: 7, count: 31).base64EncodedString()])) |
| 14 | } |
| 15 | |
| 16 | func testDevelopmentBundleDoesNotStartUpdater() { |
| 17 | let updater = NativeUpdater() |
| 18 | XCTAssertFalse(updater.isConfigured) |
| 19 | XCTAssertFalse(updater.canCheckForUpdates) |
| 20 | updater.checkForUpdates() |
| 21 | updater.automaticallyChecksForUpdates = true |
| 22 | XCTAssertFalse(updater.automaticallyChecksForUpdates) |
| 23 | } |
| 24 | } |
| 25 | #endif |
| 26 | |