Skip to content

DeprecatedWebhookTriggerAuthTest only checks the controller's self-reported count, never that a Delivery/job was actually created #163

Description

@morcen

What: test_deprecated_trigger_route_works_for_authenticated_users asserts $response->assertJson(['deliveries_created' => 1]) but never verifies the underlying side effects — no assertDatabaseCount('deliveries', 1), assertDatabaseHas(...), or Bus::assertDispatched(SendWebhook::class).

Where: tests/Feature/DeprecatedWebhookTriggerAuthTest.php:28-43

Why it matters: The test only checks that the controller's JSON echoes back a count of 1 — if a future regression on the deprecated alias route (which CLAUDE.md documents as "unversioned routes remain as deprecated aliases") caused it to report a count without actually creating the Delivery row or dispatching SendWebhook, this test would still pass. The sibling WebhookPayloadSizeLimitTest correctly guards against exactly this class of gap on the versioned route by asserting assertDatabaseCount. A silent divergence between the deprecated and versioned trigger paths could ship undetected.

Suggested fix: Add $this->assertDatabaseCount('deliveries', 1); and/or Bus::fake(); ... Bus::assertDispatched(SendWebhook::class); alongside the existing JSON assertion, mirroring WebhookPayloadSizeLimitTest.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions