From 219c74b547e947f03662315d3dad781ad100f175 Mon Sep 17 00:00:00 2001 From: KacperWybranski Date: Sun, 2 May 2021 20:31:07 +0200 Subject: [PATCH] Add search URL scheme test --- ClientTests/NavigationRouterTests.swift | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/ClientTests/NavigationRouterTests.swift b/ClientTests/NavigationRouterTests.swift index d9caf851c32..3bbb4d0f062 100644 --- a/ClientTests/NavigationRouterTests.swift +++ b/ClientTests/NavigationRouterTests.swift @@ -42,6 +42,14 @@ class NavigationRouterTests: XCTestCase { XCTAssertEqual(badNav, NavigationPath.url(webURL: URL(string: "blah"), isPrivate: false)) } + func testSearchScheme() { + let query = "Foo Bar".addingPercentEncoding(withAllowedCharacters: .alphanumerics)! + let appURL = "\(appScheme)://search?q="+query + let navItem = NavigationPath(url: URL(string: appURL)!)! + + XCTAssertEqual(navItem, NavigationPath.text("Foo Bar")) + } + func testDefaultNavigationPath() { let url = URL(string: "https://duckduckgo.com")! let appURL = URL(string: "\(self.appScheme)://open-url?url=\(url.absoluteString.escape()!)")!