feat: adapt device models api
Some checks are pending
tests / ci (push) Waiting to run

This commit is contained in:
Benjamin Nussbaum 2025-08-16 09:41:00 +02:00
parent a88e72b75e
commit ba3bf31bb7
29 changed files with 2379 additions and 215 deletions

View file

@ -11,7 +11,7 @@ beforeEach(function () {
test('it creates new firmware record when polling', function () {
Http::fake([
'usetrmnl.com/api/firmware/latest' => Http::response([
'https://usetrmnl.com/api/firmware/latest' => Http::response([
'version' => '1.0.0',
'url' => 'https://example.com/firmware.bin',
], 200),
@ -33,7 +33,7 @@ test('it updates existing firmware record when polling', function () {
]);
Http::fake([
'usetrmnl.com/api/firmware/latest' => Http::response([
'https://usetrmnl.com/api/firmware/latest' => Http::response([
'version' => '1.0.0',
'url' => 'https://new-url.com/firmware.bin',
], 200),
@ -53,7 +53,7 @@ test('it marks previous firmware as not latest when new version is found', funct
]);
Http::fake([
'usetrmnl.com/api/firmware/latest' => Http::response([
'https://usetrmnl.com/api/firmware/latest' => Http::response([
'version' => '1.1.0',
'url' => 'https://example.com/firmware.bin',
], 200),
@ -67,7 +67,7 @@ test('it marks previous firmware as not latest when new version is found', funct
test('it handles connection exception gracefully', function () {
Http::fake([
'usetrmnl.com/api/firmware/latest' => function () {
'https://usetrmnl.com/api/firmware/latest' => function () {
throw new ConnectionException('Connection failed');
},
]);
@ -80,7 +80,7 @@ test('it handles connection exception gracefully', function () {
test('it handles invalid response gracefully', function () {
Http::fake([
'usetrmnl.com/api/firmware/latest' => Http::response(null, 200),
'https://usetrmnl.com/api/firmware/latest' => Http::response(null, 200),
]);
(new FirmwarePollJob)->handle();
@ -91,7 +91,7 @@ test('it handles invalid response gracefully', function () {
test('it handles missing version in response gracefully', function () {
Http::fake([
'usetrmnl.com/api/firmware/latest' => Http::response([
'https://usetrmnl.com/api/firmware/latest' => Http::response([
'url' => 'https://example.com/firmware.bin',
], 200),
]);
@ -104,7 +104,7 @@ test('it handles missing version in response gracefully', function () {
test('it handles missing url in response gracefully', function () {
Http::fake([
'usetrmnl.com/api/firmware/latest' => Http::response([
'https://usetrmnl.com/api/firmware/latest' => Http::response([
'version' => '1.0.0',
], 200),
]);