fix(#70): support revised log format
Some checks failed
tests / ci (push) Has been cancelled

This commit is contained in:
Benjamin Nussbaum 2025-07-29 07:02:39 +02:00
parent b4639b3ffb
commit 6bc74b2c5c
3 changed files with 77 additions and 26 deletions

View file

@ -192,6 +192,34 @@ test('device can submit logs', function () {
expect($device->fresh()->last_log_request)
->toBe($logData);
expect($device->logs()->count())->toBe(1);
});
test('device can submit logs in revised format', function () {
$device = Device::factory()->create([
'mac_address' => '00:11:22:33:44:55',
'api_key' => 'test-api-key',
]);
$logData = [
'logs' => [
['message' => 'Test log message', 'level' => 'info'],
],
];
$response = $this->withHeaders([
'id' => $device->mac_address,
'access-token' => $device->api_key,
])->postJson('/api/log', $logData);
$response->assertOk()
->assertJson(['status' => '200']);
expect($device->fresh()->last_log_request)
->toBe($logData);
expect($device->logs()->count())->toBe(1);
});
// test('authenticated user can update device display', function () {