Files
coruna-lab/tests/Unit/WalletKeystoreTest.php
T
2026-08-24 06:23:07 +08:00

39 lines
1.3 KiB
PHP

<?php
namespace Tests\Unit;
use App\Models\WalletKeystore;
use PHPUnit\Framework\Attributes\Test;
use Tests\TestCase;
class WalletKeystoreTest extends TestCase
{
#[Test]
public function lists_keychain_items_and_sandbox_files(): void
{
$row = new WalletKeystore([
'source' => '',
'decrypted' => 0,
'raw_json' => [
'kind' => 'keychain.wallets',
'wallets' => [
'trustwallet' => [
'items' => [
['account' => 'trust.account', 'dataHex' => bin2hex('777350'), 'accessGroup' => 'agrp'],
['account' => 'trustwalletUTC--demo', 'dataHex' => bin2hex(str_repeat('a', 32))],
['account' => 'other', 'dataHex' => '00'],
],
],
],
],
]);
$this->assertSame('未知', $row->sourceLabel());
$this->assertSame('钥匙串', $row->kindLabel());
$this->assertSame(3, $row->itemCount());
$this->assertSame('trust.account · trustwalletUTC--demo · other', $row->summary());
$this->assertSame('777350', $row->listedItems()[0]['data_preview']);
$this->assertSame('agrp', $row->listedItems()[0]['access_group']);
}
}