Files
Yuvomi-App/ios/Tests/BrowserModelTests.swift
T
Yuvomi Mobile Contributors d70c5cc2de fix(ios): bind export cancellation to the originating download
Ignore late picker callbacks that no longer match the active download. Add an Apple-platform regression; Swift formatting, parsing and seven portable policy tests pass locally, but the new WKWebView regression requires Xcode and has not run here.
2026-10-21 07:27:34 +02:00

41 lines
1.4 KiB
Swift

import WebKit
import XCTest
@testable import Yuvomi
final class BrowserModelTests: XCTestCase {
@MainActor
func testMainViewHasNoNativeBridgeOrAutomaticPopupAccess() {
let model = BrowserModel()
XCTAssertFalse(model.web.configuration.preferences.javaScriptCanOpenWindowsAutomatically)
XCTAssertTrue(model.web.configuration.userContentController.userScripts.isEmpty)
XCTAssertTrue(model.web.configuration.websiteDataStore.isPersistent)
XCTAssertFalse(model.web.isInspectable)
}
@MainActor
func testLateExportCancellationDoesNotEraseAnotherServersDownload() {
let model = BrowserModel()
let previous = URL(fileURLWithPath: "/old-selection.txt")
let current = URL(fileURLWithPath: "/new-selection.txt")
model.download = WebDestination(url: current)
model.removeDownload(expected: previous)
XCTAssertEqual(model.download?.url, current)
model.removeDownload(expected: current)
XCTAssertNil(model.download)
}
@MainActor
func testServerErasureReplacesHistoryContext() async {
let model = BrowserModel()
let previousView = model.web
await withCheckedContinuation { continuation in
model.erase { continuation.resume() }
}
XCTAssertFalse(previousView === model.web)
XCTAssertNil(model.server)
XCTAssertFalse(model.canGoBack)
XCTAssertNil(model.error)
}
}