feat: revenue cat
CI / 🧪 Tests Laravel (push) Successful in 2m24s
CI / 🐳 Build & Push Image (push) Successful in 1m13s

This commit is contained in:
2026-08-12 16:00:11 +02:00
parent 31633cfd2c
commit 29e85589b0
55 changed files with 703 additions and 2363 deletions
+11 -12
View File
@@ -5,9 +5,11 @@ use Illuminate\Foundation\Testing\RefreshDatabase;
uses(RefreshDatabase::class);
it('grants analysis access during the generic trial', function () {
it('grants analysis access during a RevenueCat subscription trial', function () {
$user = User::factory()->create([
'trial_ends_at' => now()->addDay(),
'subscription_expires_at' => now()->addDay(),
'subscription_is_trial' => true,
'subscription_product_id' => 'monthly',
]);
expect($user->canAnalyzeMeals())->toBeTrue()
@@ -16,23 +18,20 @@ it('grants analysis access during the generic trial', function () {
it('grants analysis access to active subscribers', function () {
$user = User::factory()->create([
'trial_ends_at' => now()->subDay(),
]);
$user->subscriptions()->create([
'type' => 'default',
'stripe_id' => 'sub_active',
'stripe_status' => 'active',
'stripe_price' => 'price_subscription',
'subscription_expires_at' => now()->addYear(),
'subscription_is_trial' => false,
'subscription_product_id' => 'yearly',
]);
expect($user->canAnalyzeMeals())->toBeTrue()
->and($user->analysisAccessLevel())->toBe('subscribed');
});
it('keeps publishing accounts free without analysis access after the trial', function () {
it('keeps publishing accounts free without a subscription', function () {
$user = User::factory()->create([
'trial_ends_at' => now()->subDay(),
'subscription_expires_at' => now()->subDay(),
'subscription_is_trial' => true,
'subscription_product_id' => 'monthly',
]);
expect($user->canAnalyzeMeals())->toBeFalse()