- New BillingEvent enum replaces 'subscription.{created,updated,cancelled}'
strings across StripeEventListener, TrackBilling and tests.
- SendEvent now takes (method, payload) directly instead of an array of
single-call shapes — overhead with no batching benefit.
- PostHogService consolidates the 3 api-key short-circuits into shouldSend().
- SyncUser eager-loads currentWorkspace.withCount('socialAccounts') and
drops the redundant posts_count from the workspace group identify.
- Frontend Usage interface centralised in resources/js/types — was
duplicated in posthog.ts and useFeatureAccess.ts.
- posthog.init moved out of module-import side-effect into
initializePostHog() called explicitly from app.ts.
- SyncUserTest cleans up the convoluted assertion that merged
$job->calls with Queue::pushed().
- Drop tests/Feature/StripeEventListenerTest.php (orphan, fully covered
by tests/Feature/Listeners/StripeEventListenerTest.php).
- Revert .github/FUNDING.yml to match origin/main.
29 lines
732 B
PHP
29 lines
732 B
PHP
<?php
|
|
|
|
declare(strict_types=1);
|
|
|
|
use App\Jobs\PostHog\SendEvent;
|
|
|
|
test('job is queued on posthog queue', function () {
|
|
$job = new SendEvent('capture', ['distinctId' => 'user-1', 'event' => 'test']);
|
|
|
|
expect($job->queue)->toBe('posthog');
|
|
});
|
|
|
|
test('job skips execution when api key is missing', function () {
|
|
config(['services.posthog.api_key' => null]);
|
|
|
|
$job = new SendEvent('capture', ['distinctId' => 'user-1', 'event' => 'test']);
|
|
|
|
// Should not throw - silently skips
|
|
$job->handle();
|
|
|
|
expect(true)->toBeTrue();
|
|
});
|
|
|
|
test('job has correct retry and timeout settings', function () {
|
|
$job = new SendEvent('capture', []);
|
|
|
|
expect($job->tries)->toBe(3);
|
|
expect($job->timeout)->toBe(15);
|
|
});
|