<?php

namespace Tests\Feature;

use Tests\TestCase;

class AdminJsMerchantRevenueRank7dShouldParseMerchantIdFromLinksMapTest extends TestCase
{
    public function test_admin_js_merchant_revenue_rank_7d_should_parse_merchant_id_from_links_map(): void
    {
        $js = (string) file_get_contents(public_path('js/admin.js'));

        // 护栏：应从表格链接中解析 merchant_id，而不是用 href*="merchant_id=ID" 做模糊匹配
        $this->assertStringContainsString('[data-role="merchant-revenue-rank-7d"] a.link[href*="merchant_id="]', $js);
        $this->assertStringContainsString('href.match(/[?&]merchant_id=(\\d+)/)', $js);
        $this->assertStringContainsString('merchantIdToHref', $js);
    }
}
