@@ -15,7 +15,7 @@ import org.junit.jupiter.api.TestInstance
15
15
import java.util.*
16
16
17
17
@TestInstance(TestInstance .Lifecycle .PER_CLASS )
18
- class EksternVarslingSinkTest {
18
+ class EksternVarslingSubscriberTest {
19
19
20
20
private val db = LocalPostgresDatabase .cleanDb()
21
21
private val varselRepository = VarselRepository (db)
@@ -104,6 +104,15 @@ class EksternVarslingSinkTest {
104
104
varsel3.eksternVarslingSendtSms shouldBe true
105
105
varsel3.eksternVarslingSendtEpost shouldBe true
106
106
}
107
+
108
+ @Test
109
+ fun `leser også eventer fra ny ekstern-varsling app` () {
110
+ broadcaster.broadcastJson(SMS .testMessageNew(" 123" ))
111
+ broadcaster.broadcastJson(EPOST .testMessageNew(" 124" ))
112
+
113
+ db.getEksternVarsling(" 123" ).first() shouldNotBe null
114
+ db.getEksternVarsling(" 124" ).first() shouldNotBe null
115
+ }
107
116
}
108
117
109
118
@@ -121,3 +130,19 @@ private fun String.testMessage(eventId: String, ident: String = eksternVarslingT
121
130
"kanal": "${this } ",
122
131
"tidspunkt": "${nowAtUtcZ()} "
123
132
}"""
133
+
134
+ private fun String.testMessageNew (eventId : String , ident : String = eksternVarslingTestIdent) = """ {
135
+ "@event_name": "eksternVarslingStatusOppdatert",
136
+ "ident": "$ident ",
137
+ "status": "sendt",
138
+ "varselId": "$eventId ",
139
+ "varseltype": "oppgave",
140
+ "produsent": {
141
+ "cluster": "dev-gcp",
142
+ "namespace": "pto",
143
+ "appnavn": "veilarbaktivitet"
144
+ },
145
+ "kanal": "${this } ",
146
+ "batch": true,
147
+ "tidspunkt": "${nowAtUtcZ()} "
148
+ }"""
0 commit comments