pricePerImpressionRub(0))->toBe('0.45') // volume floored to >=1 ->and($p->pricePerImpressionRub(999))->toBe('0.45') ->and($p->pricePerImpressionRub(1000))->toBe('0.42') ->and($p->pricePerImpressionRub(4999))->toBe('0.42') ->and($p->pricePerImpressionRub(5000))->toBe('0.40') ->and($p->pricePerImpressionRub(9999))->toBe('0.40') ->and($p->pricePerImpressionRub(10000))->toBe('0.38') ->and($p->pricePerImpressionRub(49999))->toBe('0.38') ->and($p->pricePerImpressionRub(50000))->toBe('0.36') ->and($p->pricePerImpressionRub(500000))->toBe('0.36'); }); it('смета = объём показов × цена ступени', function () { $p = app(TelegramTariffService::class); // 500 показов → ступень 0.45 → 225.00 expect($p->estimateRub(500))->toBe('225.00') // 1000 показов → ступень 0.42 → 420.00 ->and($p->estimateRub(1000))->toBe('420.00') // 5000 показов → ступень 0.40 → 2000.00 ->and($p->estimateRub(5000))->toBe('2000.00') // 0 показов → 0.00 ->and($p->estimateRub(0))->toBe('0.00'); }); it('клиентская смета = базовая смета × наценка (по умолчанию 1.40)', function () { config()->set('client_tg.markup', '1.40'); $p = app(TelegramTariffService::class); // 500 показов: база 225.00 × 1.40 = 315.00 expect($p->clientEstimateRub(500))->toBe('315.00') // 1000 показов: база 420.00 × 1.40 = 588.00 ->and($p->clientEstimateRub(1000))->toBe('588.00') // 0 показов → 0.00 ->and($p->clientEstimateRub(0))->toBe('0.00'); }); it('наценка берётся из config (переопределяемая)', function () { config()->set('client_tg.markup', '2.00'); $p = app(TelegramTariffService::class); // 500 показов: база 225.00 × 2.00 = 450.00 expect($p->clientEstimateRub(500))->toBe('450.00'); });