feat: new chain

This commit is contained in:
hashbro
2026-08-11 02:26:43 +08:00
parent ec2d9f2308
commit 9bf769b2bd
56 changed files with 3806 additions and 325 deletions
+28 -3
View File
@@ -107,13 +107,38 @@ class PageVisitTest extends TestCase
'created_at' => now(),
]);
PageVisit::query()->create([
'channel_id' => self::CHANNEL,
'client_uid' => 'u3',
'os' => 'iOS',
'os_version' => '17.0',
'browser' => 'Safari',
'browser_version' => '17.0',
'created_at' => now(),
]);
PageVisit::query()->create([
'channel_id' => self::CHANNEL,
'client_uid' => 'u4',
'os' => 'iOS',
'os_version' => '16.0',
'browser' => 'Chrome',
'browser_version' => '119.0',
'created_at' => now(),
]);
$admin = Admin::query()->create(['username' => 'admin', 'password' => 'admin123']);
$this->actingAs($admin, 'admin')
->getJson(route('admin.dashboard.data', ['range' => 'today']))
->assertOk()
->assertJsonPath('data.pv', 3)
->assertJsonPath('data.uv', 2)
->assertJsonStructure(['data' => ['by_os', 'by_browser', 'pv', 'uv']]);
->assertJsonPath('data.pv', 5)
->assertJsonPath('data.uv', 4)
->assertJsonPath('data.effective_pv', 2)
->assertJsonPath('data.effective_uv', 1)
->assertJsonPath('data.by_os.0.label', 'iOS')
->assertJsonPath('data.by_os.0.pv', 4)
->assertJsonPath('data.by_os.1.label', '其他')
->assertJsonPath('data.by_os.1.pv', 1)
->assertJsonStructure(['data' => ['by_os', 'by_ios_version', 'pv', 'uv', 'effective_pv', 'effective_uv']]);
}
#[Test]