diff --git a/tests/Feature/Jobs/PostHog/TrackBillingTest.php b/tests/Feature/Jobs/PostHog/TrackBillingTest.php index 5e0e941b..5a6d0ecb 100644 --- a/tests/Feature/Jobs/PostHog/TrackBillingTest.php +++ b/tests/Feature/Jobs/PostHog/TrackBillingTest.php @@ -3,6 +3,7 @@ declare(strict_types=1); use App\Enums\PostHog\BillingEvent; +use App\Enums\User\Persona; use App\Jobs\PostHog\SendEvent; use App\Jobs\PostHog\SyncUser; use App\Jobs\PostHog\TrackBilling; @@ -50,6 +51,19 @@ }); }); +test('handle forwards the owner persona as an event property', function () { + $this->user->update(['persona' => Persona::Agency->value]); + Queue::fake(); + + (new TrackBilling((string) $this->account->id, BillingEvent::Created, $this->payload)) + ->handle(app(PostHogService::class)); + + Queue::assertPushed( + SendEvent::class, + fn ($job) => ($job->payload['properties']['persona'] ?? null) === Persona::Agency->value, + ); +}); + test('handle forwards previousPlan as a property when supplied', function () { Queue::fake();