// // OmniIntentTests.swift // Zyquo Atlas // // Author: Simon-Pierre Boucher // Mail: contact@spboucher.ai // // Verifies the Phase 2 omnibox URL-vs-search resolution (the phase gate's // "omnibox must resolve URL vs. search" requirement). // import Foundation import Testing @testable import ZyquoAtlas @Suite struct OmniIntentTests { @Test func explicitSchemeNavigates() { #expect(OmniIntent.resolve("https://apple.com") == .navigate(URL(string: "https://apple.com")!)) #expect(OmniIntent.resolve("http://example.org/path") == .navigate(URL(string: "http://example.org/path")!)) } @Test func bareHostBecomesHTTPS() { #expect(OmniIntent.resolve("github.com") == .navigate(URL(string: "https://github.com")!)) #expect(OmniIntent.resolve("news.ycombinator.com/newest") == .navigate(URL(string: "https://news.ycombinator.com/newest")!)) } @Test func localhostAndIPNavigate() { #expect(OmniIntent.resolve("localhost:8080") == .navigate(URL(string: "https://localhost:8080")!)) #expect(OmniIntent.resolve("127.0.0.1") == .navigate(URL(string: "https://127.0.0.1")!)) } @Test func multiWordOrPlainTextSearches() { #expect(OmniIntent.resolve("best coffee in montreal") == .search("best coffee in montreal")) #expect(OmniIntent.resolve("swift concurrency") == .search("swift concurrency")) } @Test func singleWordWithoutTLDSearches() { #expect(OmniIntent.resolve("swift") == .search("swift")) } @Test func searchIntentProducesQueryURL() { let intent = OmniIntent.resolve("hello world") let url = intent.url #expect(url != nil) #expect(url!.absoluteString.contains("hello%20world")) } }