Skip to content

Add tests for URL normalization and Chrome Web Store ID parsing #34

Description

@culpen90

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions