Skip to content

tests: fill coverage gaps in filters, listeners, middleware, model#350

Open
jbrooksuk wants to merge 1 commit intomainfrom
tests/fill-coverage-gaps
Open

tests: fill coverage gaps in filters, listeners, middleware, model#350
jbrooksuk wants to merge 1 commit intomainfrom
tests/fill-coverage-gaps

Conversation

@jbrooksuk
Copy link
Copy Markdown
Member

Summary

Fills gaps in the test suite for classes that had meaningful logic but no direct coverage. Walked the src/ tree against the tests/ tree and targeted the units where branches were going unexercised.

  • ScheduleStatusFilter — single-value, enum-instance, invalid value, multi-value, and mixed-validity input branches. Existing API feature tests only exercised the happy path.
  • WebhookCallEventListener — persists WebhookAttempt rows from WebhookCallSucceededEvent/WebhookCallFailedEvent and triggers the subscription success-rate recalculation. Previously only tested transitively.
  • WebhookAttempt modelisSuccess() across 2xx/non-2xx, whereSuccessful scope, and prunable() respecting cachet.webhooks.logs.prune_logs_after_days.
  • SetAppLocale middleware — no-user passthrough, authenticated user's preferredLocale(), and fallback to Accept-Language when the user has no preferred locale set.

No production code changed. Full suite: 406 passing.

Test plan

  • vendor/bin/pest tests/Unit/Filters/ScheduleStatusFilterTest.php
  • vendor/bin/pest tests/Unit/Listeners/WebhookCallEventListenerTest.php
  • vendor/bin/pest tests/Unit/Models/WebhookAttemptTest.php
  • vendor/bin/pest tests/Unit/Http/Middleware/SetAppLocaleTest.php
  • php -d memory_limit=512M vendor/bin/pest (full suite)

🤖 Generated with Claude Code

Fill gaps in the test suite for areas that had meaningful logic but no
direct coverage:

- ScheduleStatusFilter: single/multi-value and invalid-input branches
- WebhookCallEventListener: attempt persistence and success-rate recalc
- WebhookAttempt: isSuccess(), whereSuccessful scope, prunable()
- SetAppLocale middleware: user/no-user and preferred-locale fallback

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant