dashboard: merchant revenue rank links include 7d created_at range

This commit is contained in:
萝卜
2026-03-16 00:34:35 +08:00
parent 7e3274bc3d
commit 6a7c8c6dc3
2 changed files with 44 additions and 1 deletions

View File

@@ -0,0 +1,39 @@
<?php
namespace Tests\Feature;
use Illuminate\Foundation\Testing\RefreshDatabase;
use Tests\TestCase;
class AdminDashboardMerchantRevenueRank7dLinkShouldIncludeDateRangeTest extends TestCase
{
use RefreshDatabase;
protected function loginAsPlatformAdmin(): void
{
$this->seed();
$this->post('/admin/login', [
'email' => 'platform.admin@demo.local',
'password' => 'Platform@123456',
])->assertRedirect('/admin');
}
public function test_dashboard_merchant_revenue_rank_7d_link_should_include_date_range(): void
{
$this->loginAsPlatformAdmin();
$res = $this->get('/admin');
$res->assertOk();
$from = now()->subDays(6)->format('Y-m-d');
$to = now()->format('Y-m-d');
// 排行卡的站点链接应带上近7天日期范围 + back
$res->assertSee('data-role="merchant-revenue-rank-7d"', false);
$res->assertSee('created_from=' . $from, false);
$res->assertSee('created_to=' . $to, false);
$res->assertSee('back=%2Fadmin', false);
$res->assertDontSee('&amp;back=', false);
}
}