Why
Quartz has important parsing behavior in Sources/Quartz/QuartzApp.swift and Sources/Quartz/QuartzWebExtensionSupport.swift: address/search normalization, localhost handling, file/http/https schemes, and Chrome Web Store extension ID extraction. These are easy to regress because the project currently has no test target.
Where to start
Package.swift
Sources/Quartz/QuartzApp.swift
Sources/Quartz/QuartzWebExtensionSupport.swift
- A new
Tests/QuartzTests/ target
Suggested approach
Add a small XCTest target and move the pure parsing logic into testable helpers. Keep UI/AppKit code in place; this issue is about extracting only the pure functions needed for tests.
Useful cases to cover:
example.com becomes https://example.com.
localhost and localhost:8080 are treated as hosts.
- plain search text becomes a DuckDuckGo search URL.
http, https, and file URLs are accepted as URLs.
- valid 32-character Chrome Web Store IDs are accepted.
- malformed Chrome Web Store URLs/IDs are rejected.
Acceptance criteria
swift test runs a new Quartz test target.
- The parsing helpers remain usable by the app.
- Tests cover both successful and rejected inputs.
swift build still succeeds.
Testing
- Run
swift test.
- Run
swift build.
Why
Quartz has important parsing behavior in
Sources/Quartz/QuartzApp.swiftandSources/Quartz/QuartzWebExtensionSupport.swift: address/search normalization, localhost handling, file/http/https schemes, and Chrome Web Store extension ID extraction. These are easy to regress because the project currently has no test target.Where to start
Package.swiftSources/Quartz/QuartzApp.swiftSources/Quartz/QuartzWebExtensionSupport.swiftTests/QuartzTests/targetSuggested approach
Add a small XCTest target and move the pure parsing logic into testable helpers. Keep UI/AppKit code in place; this issue is about extracting only the pure functions needed for tests.
Useful cases to cover:
example.combecomeshttps://example.com.localhostandlocalhost:8080are treated as hosts.http,https, andfileURLs are accepted as URLs.Acceptance criteria
swift testruns a new Quartz test target.swift buildstill succeeds.Testing
swift test.swift build.