diff --git a/tests/Feature/NotificationTest.php b/tests/Feature/NotificationTest.php
index 7ef44af..6412b32 100644
--- a/tests/Feature/NotificationTest.php
+++ b/tests/Feature/NotificationTest.php
@@ -73,6 +73,34 @@ class NotificationTest extends TestCase
$this->assertSame('secret', Addon::where('key', 'smtp')->first()->config['password']);
}
+ public function test_dead_battery_at_zero_percent_alerts(): void
+ {
+ Mail::fake();
+ $this->configureSmtp();
+
+ $device = \App\Models\Device::create(['name' => 'Sensor', 'vendor' => 'Shelly', 'protocol' => 'mqtt', 'status' => 'active', 'demo' => false, 'last_seen_at' => now(), 'config' => ['mqtt_prefix' => 'x']]);
+ $entity = \App\Models\Entity::create(['device_id' => $device->id, 'type' => 'battery', 'key' => 'battery:0']);
+ \App\Models\DeviceState::create(['entity_id' => $entity->id, 'state' => ['percent' => 0]]);
+
+ $this->artisan('notifications:sweep')->assertSuccessful();
+
+ $this->assertTrue(Cache::has("notified:battery:{$entity->id}"));
+ }
+
+ public function test_smtp_setup_allows_no_encryption(): void
+ {
+ $this->actingAs(User::factory()->create());
+
+ Livewire::test(SmtpSetup::class)
+ ->set('host', 'localhost')->set('port', '25')->set('encryption', '')
+ ->set('fromEmail', 'a@b.com')->set('toEmail', 'c@d.com')
+ ->call('save')
+ ->assertHasNoErrors()
+ ->assertRedirect(route('addons.index'));
+
+ $this->assertSame('', Addon::where('key', 'smtp')->first()->config['encryption']);
+ }
+
public function test_sweep_emails_once_per_offline_device(): void
{
Mail::fake();