pricing = app(CreditPricingService::class); }); test('extra-pm credits follow the tier staffel', function () { expect($this->pricing->extraPmCredits(Tier::Einzel))->toBe(19); expect($this->pricing->extraPmCredits(Tier::Starter))->toBe(15); expect($this->pricing->extraPmCredits(Tier::Business))->toBe(12); expect($this->pricing->extraPmCredits(Tier::Pro))->toBe(10); expect($this->pricing->extraPmCredits(Tier::Agency))->toBe(8); }); test('a user without a plan is on the Einzel tier and pays the full extra-pm rate', function () { $user = User::factory()->create(); expect($user->currentTier())->toBe(Tier::Einzel); expect($this->pricing->extraPmCreditsFor($user))->toBe(19); }); test('a subscriber inherits the tier of the plan slug', function () { $user = User::factory()->create(); $plan = Plan::factory()->create([ 'slug' => 'business', 'stripe_price_id_monthly' => 'price_biz_'.fake()->unique()->randomNumber(6), ]); subscribeUserToPlan($user, $plan); expect($user->currentTier())->toBe(Tier::Business); expect($this->pricing->extraPmCreditsFor($user))->toBe(12); }); test('boost credits follow the duration staffel and reject unknown durations', function () { expect($this->pricing->boostCredits(7))->toBe(12); expect($this->pricing->boostCredits(14))->toBe(20); expect($this->pricing->boostCredits(30))->toBe(35); expect($this->pricing->boostOptions())->toBe([7 => 12, 14 => 20, 30 => 35]); expect(fn () => $this->pricing->boostCredits(99)) ->toThrow(InvalidArgumentException::class); }); test('flat prices match the decision update', function () { expect($this->pricing->proofPdfCredits())->toBe(3); expect($this->pricing->depublishCredits())->toBe(25); }); test('review free quota follows the tier staffel', function () { expect($this->pricing->reviewFreeQuota(Tier::Einzel))->toBe(4); expect($this->pricing->reviewFreeQuota(Tier::Starter))->toBe(12); expect($this->pricing->reviewFreeQuota(Tier::Business))->toBe(30); expect($this->pricing->reviewFreeQuota(Tier::Pro))->toBe(60); expect($this->pricing->reviewFreeQuota(Tier::Agency))->toBe(120); expect($this->pricing->reviewDailyLimit())->toBe(10); expect($this->pricing->reviewOverflowCost())->toBe(1); });