From 20d2b6278bf93523e2ef11606f7e842706439968 Mon Sep 17 00:00:00 2001 From: Ivan Moroz Date: Tue, 2 Jun 2026 15:26:58 +0300 Subject: [PATCH] CONV-222: Test image to PDF cost Co-Authored-By: Claude Sonnet 4.6 --- .../Services/ConversionCostEstimatorTest.php | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/tests/Unit/Services/ConversionCostEstimatorTest.php b/tests/Unit/Services/ConversionCostEstimatorTest.php index 5954fe6..24329a2 100644 --- a/tests/Unit/Services/ConversionCostEstimatorTest.php +++ b/tests/Unit/Services/ConversionCostEstimatorTest.php @@ -23,3 +23,21 @@ expect($cost->amount)->toBe(1); }); + +it('estimates image to pdf conversion as two credits', function () { + $file = FileRecord::factory()->png()->make(['user_id' => 1]); + $converter = app(ConverterRegistry::class)->find('png', 'pdf'); + + $cost = app(ConversionCostEstimator::class)->estimate($file, $converter, []); + + expect($cost->amount)->toBe(2); +}); + +it('estimates jpg to pdf conversion as two credits', function () { + $file = FileRecord::factory()->jpg()->make(['user_id' => 1]); + $converter = app(ConverterRegistry::class)->find('jpg', 'pdf'); + + $cost = app(ConversionCostEstimator::class)->estimate($file, $converter, []); + + expect($cost->amount)->toBe(2); +});