From 397789df92ffd8cbf367d7f7b77a34e0ed191775 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=90=9D=E5=8D=9C?= Date: Sun, 15 Mar 2026 22:59:04 +0800 Subject: [PATCH] test: dashboard platform order trend 7d should render --- ...rmOrderTrend7dCardShouldRenderRowsTest.php | 38 +++++++++++++++++++ 1 file changed, 38 insertions(+) create mode 100644 tests/Feature/AdminDashboardPlatformOrderTrend7dCardShouldRenderRowsTest.php diff --git a/tests/Feature/AdminDashboardPlatformOrderTrend7dCardShouldRenderRowsTest.php b/tests/Feature/AdminDashboardPlatformOrderTrend7dCardShouldRenderRowsTest.php new file mode 100644 index 0000000..47067a2 --- /dev/null +++ b/tests/Feature/AdminDashboardPlatformOrderTrend7dCardShouldRenderRowsTest.php @@ -0,0 +1,38 @@ +seed(); + + $this->post('/admin/login', [ + 'email' => 'platform.admin@demo.local', + 'password' => 'Platform@123456', + ])->assertRedirect('/admin'); + } + + public function test_dashboard_platform_order_trend_7d_card_should_render_rows(): void + { + $this->loginAsPlatformAdmin(); + + $res = $this->get('/admin'); + $res->assertOk(); + + // 趋势卡(近7天)应存在,并渲染 7 天的行(即使当天无数据也补 0) + $res->assertSee('data-role="platform-order-trend-7d"', false); + + $html = (string) $res->getContent(); + + // 粗略计数:tbody 内应出现 7 次日期文本(YYYY-MM-DD) + preg_match_all('/\d{4}-\d{2}-\d{2}/', $html, $m); + $this->assertGreaterThanOrEqual(7, count($m[0] ?? [])); + } +}