Repository Public
1import MCCCore2import XCTest3@testable import MCC45@MainActor6final class ShellTests: XCTestCase {7 func testDeepLinks() {8 let id = "0199AAAA-0000-7000-8000-0000000000D1"9 XCTAssertEqual(DeepLink.parse(URL(string: "https://clustr.spboucher.ai/open/alerts")!), .section(.alerts))10 XCTAssertEqual(DeepLink.parse(URL(string: "https://clustr.spboucher.ai/open/nodes/\(id)")!), .node(id))11 XCTAssertEqual(DeepLink.parse(URL(string: "https://clustr.spboucher.ai/open/alerts/\(id)")!), .focus(.alerts, .alert(id)))12 XCTAssertEqual(DeepLink.parse(URL(string: "mcc-debug://open/actions/\(id)")!), .action(id))13 XCTAssertNil(DeepLink.parse(URL(string: "https://clustr.spboucher.ai/open/nodes/not-a-uuid")!))14 XCTAssertNil(DeepLink.parse(URL(string: "https://clustr.spboucher.ai/other")!))15 XCTAssertNil(DeepLink.parse(URL(string: "https://clustr.spboucher.ai/open/unknown")!))16 }1718 func testSetupLinkToken() {19 let token = String(repeating: "aB3-_", count: 9)20 XCTAssertEqual(SetupLink.token(from: "https://clustr.spboucher.ai/setup#\(token)"), token)21 XCTAssertEqual(SetupLink.token(from: " http://localhost:8760/setup#\(token)\n"), token)22 XCTAssertEqual(SetupLink.token(from: token), token)23 XCTAssertNil(SetupLink.token(from: "https://clustr.spboucher.ai/setup"))24 XCTAssertNil(SetupLink.token(from: "https://clustr.spboucher.ai/other#\(token)"))25 XCTAssertNil(SetupLink.token(from: "short"))26 XCTAssertNil(SetupLink.token(from: "has spaces and is long enough to pass the length"))27 }2829 func testSidebarCoversEverySection() {30 XCTAssertEqual(SidebarItem.allCases.count, 12)31 for item in SidebarItem.allCases {32 XCTAssertNotEqual(item.title, "nav." + item.rawValue, "missing title for \(item)")33 XCTAssertFalse(item.symbol.isEmpty)34 }35 XCTAssertEqual(Set(SidebarItem.allCases.compactMap(\.shortcut).map(\.character)).count, 10)36 XCTAssertNil(SidebarItem.settings.permission)37 }38}39