Differentiate Billing from Wallet with storage usage breakdown.
Deploy Ladill Transfer / deploy (push) Successful in 27s

Billing lists per-transfer storage costs and monthly estimates; Wallet stays focused on balance and top-up.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
isaacclad
2026-06-08 10:43:56 +00:00
co-authored by Cursor
parent c0c95c4bc8
commit 45ccd04163
6 changed files with 184 additions and 7 deletions
+75
View File
@@ -0,0 +1,75 @@
<?php
namespace Tests\Feature;
use App\Models\Transfer;
use App\Models\User;
use Illuminate\Foundation\Testing\RefreshDatabase;
use Illuminate\Support\Facades\Http;
use Illuminate\Support\Str;
use Tests\TestCase;
class BillingPageTest extends TestCase
{
use RefreshDatabase;
protected function setUp(): void
{
parent::setUp();
Http::preventStrayRequests();
}
private function user(): User
{
return User::create(['public_id' => (string) Str::uuid(), 'name' => 'A', 'email' => 'a+'.uniqid().'@x.com']);
}
private function fakeBillingApi(string $publicId): void
{
$base = rtrim((string) config('billing.api_url'), '/');
Http::fake([
$base.'/balance*' => Http::response(['balance_minor' => 50000]),
$base.'/service-ledger*' => Http::response([
'spent_minor' => 1200,
'credited_minor' => 0,
'net_minor' => -1200,
]),
]);
}
public function test_billing_page_shows_storage_breakdown(): void
{
$user = $this->user();
$this->fakeBillingApi($user->public_id);
Transfer::create([
'user_id' => $user->id,
'title' => 'Client deliverables',
'retention_days' => 30,
'expires_at' => now()->addDays(30),
'status' => Transfer::STATUS_ACTIVE,
'storage_bytes' => 2 * 1024 * 1024 * 1024,
]);
$this->actingAs($user)
->get(route('account.billing'))
->assertOk()
->assertSee('Active transfer storage')
->assertSee('Client deliverables')
->assertSee('Monthly estimate')
->assertDontSee('Add funds');
}
public function test_wallet_page_focuses_on_balance(): void
{
$user = $this->user();
$this->fakeBillingApi($user->public_id);
$this->actingAs($user)
->get(route('account.wallet'))
->assertOk()
->assertSee('Add funds')
->assertDontSee('Active transfer storage');
}
}