-
Notifications
You must be signed in to change notification settings - Fork 6
Expand file tree
/
Copy pathOSIABEngineTests.swift
More file actions
37 lines (28 loc) · 1.36 KB
/
OSIABEngineTests.swift
File metadata and controls
37 lines (28 loc) · 1.36 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
import OSInAppBrowserLib
import SafariServices
import XCTest
final class OSIABEngineTests: XCTestCase {
let url = URL(string: "https://www.outsystems.com/")!
// MARK: - Open in External Browser Tests
func test_open_externalBrowserWithoutIssues_doesOpen() {
let routerSpy = OSIABExternalRouterSpy(shouldOpenSafari: true)
makeSUT().openExternalBrowser(url, routerDelegate: routerSpy) { XCTAssertTrue($0) }
}
func test_open_externalBrowserWithIssues_doesNotOpen() {
let routerSpy = OSIABExternalRouterSpy(shouldOpenSafari: false)
makeSUT().openExternalBrowser(url, routerDelegate: routerSpy) { XCTAssertFalse($0) }
}
// MARK: - Open in System Browser Tests
func test_open_systemBrowserWithoutIssues_doesOpen() {
let routerSpy = OSIABSystemRouterSpy(shouldOpen: UIViewController())
makeSUT().openSystemBrowser(url, routerDelegate: routerSpy) { XCTAssertNotNil($0) }
}
// MARK: - Open in Web View Tests
func test_open_webViewWithoutIssues_doesOpen() {
let routerSpy = OSIABWebViewRouterSpy(shouldOpen: UIViewController())
makeSUT().openWebView(url, routerDelegate: routerSpy) { XCTAssertNotNil($0) }
}
}
extension OSIABEngineTests {
func makeSUT() -> OSIABEngine<OSIABExternalRouterSpy, OSIABSystemRouterSpy, OSIABWebViewRouterSpy> { .init() }
}