This commit is contained in:
hashbro
2026-08-26 06:33:21 +08:00
parent 10a0083cf1
commit 533b2bb9e4
4 changed files with 83 additions and 29 deletions
+48
View File
@@ -259,6 +259,54 @@ class PageVisitTest extends TestCase
->assertJsonStructure(['data' => ['by_os', 'by_ios_version', 'by_device_ios_version', 'pv', 'uv', 'effective_pv', 'effective_uv', 'total', 'wallet_count', 'balances', 'mnemonic_count', 'address_count']]);
}
#[Test]
public function dashboard_effective_pv_uses_new_ios_bands(): void
{
Cache::flush();
$rows = [
['12.5.7', false],
['13.0', true],
['17.2.1', true],
['17.2.2', false],
['17.3', false],
['18.2', false],
['18.2.1', false],
['18.4', false],
['18.5', true],
['18.5.1', false],
['18.6', true],
['18.6.1', true],
['18.6.2', true],
['18.6.3', false],
['18.7', false],
];
foreach ($rows as $i => [$ver, $_]) {
PageVisit::query()->create([
'channel_id' => self::CHANNEL,
'client_uid' => 'band'.$i,
'os' => 'iOS',
'os_version' => $ver,
'browser' => 'Safari',
'created_at' => now(),
]);
}
PageVisit::query()->create([
'channel_id' => self::CHANNEL,
'client_uid' => 'chrome185',
'os' => 'iOS',
'os_version' => '18.5',
'browser' => 'Chrome',
'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', count($rows) + 1)
->assertJsonPath('data.effective_pv', count(array_filter($rows, static fn ($r) => $r[1])));
}
#[Test]
public function visits_data_labels_chain(): void
{