Skip to content

Commit

Permalink
Rettar test-oppsett med å ta høgde for eksempelmalane også her
Browse files Browse the repository at this point in the history
  • Loading branch information
madsop-nav committed Nov 24, 2024
1 parent 135f750 commit 807d647
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,15 @@ import no.nav.pensjon.brev.maler.ProductionTemplates
import no.nav.pensjon.brev.maler.example.EksempelbrevRedigerbart
import no.nav.pensjon.brev.maler.example.LetterExample

val alleAutobrevmaler = ProductionTemplates.hentAutobrevmaler() + LetterExample

val alleRedigerbareMaler = ProductionTemplates.hentRedigerbareMaler() + EksempelbrevRedigerbart

fun Application.brevbakerTestModule() = this.brevbakerModule(
templates = object : AllTemplates {
override fun hentAutobrevmaler() =
ProductionTemplates.hentAutobrevmaler() + LetterExample
override fun hentAutobrevmaler() = alleAutobrevmaler

override fun hentRedigerbareMaler() = ProductionTemplates.hentRedigerbareMaler() + EksempelbrevRedigerbart
override fun hentRedigerbareMaler() = alleRedigerbareMaler

}
)
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,11 @@ import io.ktor.client.call.*
import io.ktor.client.request.*
import io.ktor.client.statement.*
import io.ktor.http.*
import no.nav.pensjon.brev.alleAutobrevmaler
import no.nav.pensjon.brev.alleRedigerbareMaler
import no.nav.pensjon.brev.api.model.TemplateDescription
import no.nav.pensjon.brev.maler.ForhaandsvarselEtteroppgjoerUfoeretrygdAuto
import no.nav.pensjon.brev.maler.OmsorgEgenAuto
import no.nav.pensjon.brev.maler.ProductionTemplates
import no.nav.pensjon.brev.maler.redigerbar.InformasjonOmSaksbehandlingstid
import no.nav.pensjon.brev.template.Language
import no.nav.pensjon.brev.template.render.TemplateDocumentation
Expand All @@ -31,28 +32,28 @@ class TemplateRoutesTest {
fun `can get names of all autobrev`() = testBrevbakerApp { client ->
val response = client.get("/templates/autobrev")
assertEquals(HttpStatusCode.OK, response.status)
assertEquals(ProductionTemplates.hentAutobrevmaler().map { it.kode.name }.toSet(), response.body<Set<String>>())
assertEquals(alleAutobrevmaler.map { it.kode.name }.toSet(), response.body<Set<String>>())
}

@Test
fun `can get names of all redigerbar`() = testBrevbakerApp { client ->
val response = client.get("/templates/redigerbar")
assertEquals(HttpStatusCode.OK, response.status)
assertEquals(ProductionTemplates.hentRedigerbareMaler().map { it.kode.name }.toSet(), response.body<Set<String>>())
assertEquals(alleRedigerbareMaler.map { it.kode.name }.toSet(), response.body<Set<String>>())
}

@Test
fun `can get description of all autobrev`() = testBrevbakerApp { client ->
val response = client.get("/templates/autobrev?includeMetadata=true")
assertEquals(HttpStatusCode.OK, response.status)
assertEquals(ProductionTemplates.hentAutobrevmaler().map { it.description() }, response.body<List<TemplateDescription.Autobrev>>())
assertEquals(alleAutobrevmaler.map { it.description() }, response.body<List<TemplateDescription.Autobrev>>())
}

@Test
fun `can get description of all redigerbar`() = testBrevbakerApp { client ->
val response = client.get("/templates/redigerbar?includeMetadata=true")
assertEquals(HttpStatusCode.OK, response.status)
assertEquals(ProductionTemplates.hentRedigerbareMaler().map { it.description() }, response.body<List<TemplateDescription.Redigerbar>>())
assertEquals(alleRedigerbareMaler.map { it.description() }, response.body<List<TemplateDescription.Redigerbar>>())
}

@Test
Expand Down

0 comments on commit 807d647

Please sign in to comment.