Skip to content

Add URL assertion helpers and unit tests to hammy#6

Merged
nfisher merged 1 commit into
mainfrom
codex/add-url-assertion-type-in-hammy
Jun 16, 2026
Merged

Add URL assertion helpers and unit tests to hammy#6
nfisher merged 1 commit into
mainfrom
codex/add-url-assertion-type-in-hammy

Conversation

@nfisher

@nfisher nfisher commented Jun 16, 2026

Copy link
Copy Markdown
Collaborator

Motivation

  • Provide first-class URL assertions to the hammy assertion library so tests can validate URL components directly.
  • Allow creating assertions from both *url.URL and raw string inputs with clear validation errors for invalid or nil URLs.
  • Improve failure diagnostics by returning descriptive messages for scheme, host, path, query, and full-string mismatches.

Description

  • Added hammy/url.go which implements URL, ParseURL, and the URLAssert type with methods Scheme, Host, Path, RawQuery, QueryParam, NoQueryParam, and String using the standard net/url package.
  • Implemented validation helpers invalidURL and ready and integrated with existing AssertionMessage/Assert flow to produce consistent error messages.
  • Added comprehensive unit tests in hammy/url_test.go covering success and failure cases, including nil and invalid URL handling and query parameter edge cases.

Testing

  • Added unit tests in hammy/url_test.go that exercise all assertion methods and negative paths using eye.Spy for failure inspection.
  • Ran the package tests with go test ./... which executed the new URL tests along with existing tests.
  • All automated tests completed successfully.

Codex Task

@nfisher nfisher merged commit 0df8964 into main Jun 16, 2026
1 check passed
@nfisher nfisher deleted the codex/add-url-assertion-type-in-hammy branch June 16, 2026 07:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant