Files
saasshop/tests/Feature/AdminJsMerchantRevenueRank7dChartShouldNotUseUndefinedBarRatioTest.php

25 lines
816 B
PHP
Raw Permalink Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
<?php
namespace Tests\Feature;
use Tests\TestCase;
class AdminJsMerchantRevenueRank7dChartShouldNotUseUndefinedBarRatioTest extends TestCase
{
public function test_admin_js_merchant_revenue_rank_7d_chart_should_not_use_undefined_bar_ratio(): void
{
$js = (string) file_get_contents(public_path('js/admin.js'));
// 保护Top5 站点收入排行条形图应使用 ratio 变量paid/max不应引用 barRatio。
$this->assertStringContainsString(
"bar.className = 'adm-mini-rank-bar';\n bar.style.width = Math.round(ratio * 100)",
$js
);
$this->assertStringNotContainsString(
"bar.className = 'adm-mini-rank-bar';\n bar.style.width = Math.round(barRatio * 100)",
$js
);
}
}