mirror of
https://github.com/usetrmnl/byos_laravel.git
synced 2026-01-13 15:07:49 +00:00
fix(#70): support revised log format
Some checks failed
tests / ci (push) Has been cancelled
Some checks failed
tests / ci (push) Has been cancelled
This commit is contained in:
parent
b4639b3ffb
commit
6bc74b2c5c
3 changed files with 77 additions and 26 deletions
|
|
@ -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 () {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue