create(['link_limit' => 10]); $workspace = Workspace::factory()->create(['plan_id' => $plan->id]); $service = new PlanLimitsService; expect($service->canCreateLink($workspace))->toBeTrue(); }); it('denies link creation when at limit', function () { $plan = Plan::factory()->create(['link_limit' => 2]); $workspace = Workspace::factory()->create(['plan_id' => $plan->id]); Link::factory()->count(2)->create(['workspace_id' => $workspace->id]); $service = new PlanLimitsService; expect($service->canCreateLink($workspace))->toBeFalse(); }); it('returns true when workspace has no plan', function () { $workspace = Workspace::factory()->create(['plan_id' => null]); $service = new PlanLimitsService; // No plan = free tier or trial = allow expect($service->canCreateLink($workspace))->toBeTrue(); });