X-Git-Url: https://git.pterodactylus.net/?a=blobdiff_plain;f=src%2Ftest%2Fkotlin%2Fnet%2Fpterodactylus%2Fsone%2Fweb%2Fnotification%2FNotificationHandlerModuleTest.kt;h=d4000b5cf7bf563f03f3bbdc0f246d574e95a8d4;hb=2a83103aab6254d877c1b5214ca5a3ef19a6fe83;hp=c66531bf0dcc31bbe77a2b8dc4fcff2b8bafd9bc;hpb=b2952fda6d34528489d7fa4e26e09133099c978f;p=Sone.git 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 c66531b..d4000b5 100644 --- a/src/test/kotlin/net/pterodactylus/sone/web/notification/NotificationHandlerModuleTest.kt +++ b/src/test/kotlin/net/pterodactylus/sone/web/notification/NotificationHandlerModuleTest.kt @@ -226,4 +226,43 @@ class NotificationHandlerModuleTest { injector.verifySingletonInstance() } + @Test + fun `local-post notification can be created`() { + assertThat(injector.getInstance>(named("localPost")), notNullValue()) + } + + @Test + fun `local-post notification is not dismissable`() { + assertThat(injector.getInstance>(named("localPost")).isDismissable, equalTo(false)) + } + + @Test + fun `local-post notification has correct ID`() { + assertThat(injector.getInstance>(named("localPost")).id, equalTo("local-post-notification")) + } + + @Test + fun `local-post notification has correct key and template`() { + loaders.templates += "/templates/notify/newPostNotification.html" to "<% posts>".asTemplate() + val notification = injector.getInstance>(named("localPost")) + val posts = listOf(EmptyPost("post1"), EmptyPost("post2")) + posts.forEach(notification::add) + assertThat(notification.render(), equalTo(posts.toString())) + } + + @Test + fun `local-post notification is created as singleton`() { + injector.verifySingletonInstance>(named("localPost")) + } + + @Test + fun `local-post handler can be created`() { + assertThat(injector.getInstance(), notNullValue()) + } + + @Test + fun `local-post handler is created as singleton`() { + injector.verifySingletonInstance() + } + }