<?php

namespace Tests\Feature;

use Illuminate\Foundation\Testing\RefreshDatabase;
use Tests\TestCase;

class AdminProductImportHistoriesIndexShouldUseFiltersAndListCardStructureTest 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_admin_product_import_histories_index_should_use_filters_and_list_card_structure(): void
    {
        $this->loginAsPlatformAdmin();

        $res = $this->get('/admin/products/import-histories');
        $res->assertOk();

        // 护栏：导入历史页应使用统一 Filters Card + List Card 结构。
        $res->assertSee('filters-card', false);
        $res->assertSee('filters-summary', false);
        $res->assertSee('filters-body', false);
        $res->assertSee('filters-grid', false);

        $res->assertSee('list-card', false);
        $res->assertSee('list-card-header', false);
        $res->assertSee('list-card-body', false);
        $res->assertSee('list-card-table', false);

        // 分页统一：用扫描型护栏断言。
        $blade = file_get_contents(resource_path('views/admin/products/import_histories.blade.php'));
        $this->assertIsString($blade);
        $this->assertStringContainsString("links('pagination.admin')", $blade);
    }
}
