-
-
Notifications
You must be signed in to change notification settings - Fork 426
Expand file tree
/
Copy pathHeadlessBrowserSearchServiceTests.swift
More file actions
50 lines (41 loc) · 1.63 KB
/
HeadlessBrowserSearchServiceTests.swift
File metadata and controls
50 lines (41 loc) · 1.63 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
38
39
40
41
42
43
44
45
46
47
48
49
50
import Foundation
import XCTest
@testable import WebSearchService
class HeadlessBrowserSearchServiceTests: XCTestCase {
func test_search_on_google() async throws {
let search = HeadlessBrowserSearchService(engine: .google)
do {
let result = try await search.search(query: "Snoopy")
XCTAssertFalse(result.webPages.isEmpty, "Expected non-empty search result")
} catch {
XCTFail("Search failed with error: \(error)")
}
}
func test_search_on_baidu() async throws {
let search = HeadlessBrowserSearchService(engine: .baidu)
do {
let result = try await search.search(query: "Snoopy")
XCTAssertFalse(result.webPages.isEmpty, "Expected non-empty search result")
} catch {
XCTFail("Search failed with error: \(error)")
}
}
func test_search_on_duckDuckGo() async throws {
let search = HeadlessBrowserSearchService(engine: .duckDuckGo)
do {
let result = try await search.search(query: "Snoopy")
XCTAssertFalse(result.webPages.isEmpty, "Expected non-empty search result")
} catch {
XCTFail("Search failed with error: \(error)")
}
}
func test_search_on_bing() async throws {
let search = HeadlessBrowserSearchService(engine: .bing)
do {
let result = try await search.search(query: "Snoopy")
XCTAssertFalse(result.webPages.isEmpty, "Expected non-empty search result")
} catch {
XCTFail("Search failed with error: \(error)")
}
}
}