X-Git-Url: https://git.pterodactylus.net/?p=Sone.git;a=blobdiff_plain;f=src%2Ftest%2Fkotlin%2Fnet%2Fpterodactylus%2Fsone%2Fweb%2Fnotification%2FNotificationHandlerModuleTest.kt;h=c66531bf0dcc31bbe77a2b8dc4fcff2b8bafd9bc;hp=a37abd81b488b0ac0677ce790ea82007a7481aed;hb=b2952fda6d34528489d7fa4e26e09133099c978f;hpb=8b6cad7628a282f6092113ba461f482e2cac82f4 diff --git a/src/test/kotlin/net/pterodactylus/sone/web/notification/NotificationHandlerModuleTest.kt b/src/test/kotlin/net/pterodactylus/sone/web/notification/NotificationHandlerModuleTest.kt index a37abd8..c66531b 100644 --- a/src/test/kotlin/net/pterodactylus/sone/web/notification/NotificationHandlerModuleTest.kt +++ b/src/test/kotlin/net/pterodactylus/sone/web/notification/NotificationHandlerModuleTest.kt @@ -187,4 +187,43 @@ class NotificationHandlerModuleTest { assertThat(notification.render(), equalTo(posts.toString())) } + @Test + fun `sone-locked notification can be created`() { + assertThat(injector.getInstance>(named("soneLocked")), notNullValue()) + } + + @Test + fun `sone-locked notification is created as singleton`() { + injector.verifySingletonInstance>(named("soneLocked")) + } + + @Test + fun `sone-locked notification is dismissable`() { + assertThat(injector.getInstance>(named("soneLocked")).isDismissable, equalTo(true)) + } + + @Test + fun `sone-locked notification has correct ID`() { + assertThat(injector.getInstance>(named("soneLocked")).id, equalTo("sones-locked-notification")) + } + + @Test + fun `sone-locked notification has correct key and template`() { + loaders.templates += "/templates/notify/lockedSonesNotification.html" to "<% sones>".asTemplate() + val notification = injector.getInstance>(named("soneLocked")) + val sones = listOf(IdOnlySone("sone1"), IdOnlySone("sone2")) + sones.forEach(notification::add) + assertThat(notification.render(), equalTo(sones.toString())) + } + + @Test + fun `sone-locked handler can be created`() { + assertThat(injector.getInstance(), notNullValue()) + } + + @Test + fun `sone-locked handler is created as singleton`() { + injector.verifySingletonInstance() + } + }