Skip to content

Commit

Permalink
Gå tilbake til strenge tester etter key renaming (#780)
Browse files Browse the repository at this point in the history
  • Loading branch information
bjerga authored Nov 20, 2024
1 parent 73ce524 commit 2996851
Show file tree
Hide file tree
Showing 48 changed files with 158 additions and 171 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import com.github.navikt.tbd_libs.rapids_and_rivers.test_support.TestRapid
import io.kotest.core.spec.style.FunSpec
import io.kotest.datatest.withData
import io.kotest.matchers.ints.shouldBeExactly
import io.kotest.matchers.maps.shouldContainExactly
import io.mockk.clearAllMocks
import io.mockk.coEvery
import io.mockk.coVerify
Expand All @@ -21,7 +22,6 @@ import no.nav.helsearbeidsgiver.felles.json.toMap
import no.nav.helsearbeidsgiver.felles.rapidsrivers.model.Fail
import no.nav.helsearbeidsgiver.felles.test.rapidsrivers.firstMessage
import no.nav.helsearbeidsgiver.felles.test.rapidsrivers.sendJson
import no.nav.helsearbeidsgiver.felles.test.shouldContainAllExcludingTempKey
import no.nav.helsearbeidsgiver.inntektsmelding.aareg.HentArbeidsforholdMelding
import no.nav.helsearbeidsgiver.inntektsmelding.aareg.HentArbeidsforholdRiver
import no.nav.helsearbeidsgiver.inntektsmelding.aareg.tilArbeidsforhold
Expand Down Expand Up @@ -57,7 +57,7 @@ class HentArbeidsforholdRiverTest :

testRapid.inspektør.size shouldBeExactly 1

testRapid.firstMessage().toMap() shouldContainAllExcludingTempKey
testRapid.firstMessage().toMap() shouldContainExactly
mapOf(
Key.EVENT_NAME to innkommendeMelding.eventName.toJson(),
Key.UUID to innkommendeMelding.transaksjonId.toJson(),
Expand Down Expand Up @@ -90,7 +90,7 @@ class HentArbeidsforholdRiverTest :

testRapid.inspektør.size shouldBeExactly 1

testRapid.firstMessage().toMap() shouldContainAllExcludingTempKey forventetFail.tilMelding()
testRapid.firstMessage().toMap() shouldContainExactly forventetFail.tilMelding()

coVerifySequence {
mockAaregClient.hentArbeidsforhold(innkommendeMelding.fnr.verdi, innkommendeMelding.transaksjonId.toString())
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import com.github.navikt.tbd_libs.rapids_and_rivers.test_support.TestRapid
import io.kotest.core.spec.style.FunSpec
import io.kotest.datatest.withData
import io.kotest.matchers.ints.shouldBeExactly
import io.kotest.matchers.maps.shouldContainExactly
import io.mockk.clearAllMocks
import io.mockk.coEvery
import io.mockk.coVerify
Expand All @@ -18,7 +19,6 @@ import no.nav.helsearbeidsgiver.felles.json.toMap
import no.nav.helsearbeidsgiver.felles.rapidsrivers.model.Fail
import no.nav.helsearbeidsgiver.felles.test.rapidsrivers.firstMessage
import no.nav.helsearbeidsgiver.felles.test.rapidsrivers.sendJson
import no.nav.helsearbeidsgiver.felles.test.shouldContainAllExcludingTempKey
import no.nav.helsearbeidsgiver.inntektsmelding.altinn.Mock.toMap
import no.nav.helsearbeidsgiver.utils.json.serializer.set
import no.nav.helsearbeidsgiver.utils.json.toJson
Expand Down Expand Up @@ -50,7 +50,7 @@ class AltinnRiverTest :
.mapNotNull { it.orgnr }
.toSet()

testRapid.firstMessage().toMap() shouldContainAllExcludingTempKey
testRapid.firstMessage().toMap() shouldContainExactly
mapOf(
Key.EVENT_NAME to innkommendeMelding.eventName.toJson(),
Key.UUID to innkommendeMelding.transaksjonId.toJson(),
Expand Down Expand Up @@ -86,7 +86,7 @@ class AltinnRiverTest :

testRapid.inspektør.size shouldBeExactly 1

testRapid.firstMessage().toMap() shouldContainAllExcludingTempKey forventetFail.tilMelding()
testRapid.firstMessage().toMap() shouldContainExactly forventetFail.tilMelding()

coVerifySequence {
mockAltinnClient.hentRettighetOrganisasjoner(innkommendeMelding.fnr.verdi)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import io.kotest.core.spec.style.FunSpec
import io.kotest.data.row
import io.kotest.datatest.withData
import io.kotest.matchers.ints.shouldBeExactly
import io.kotest.matchers.maps.shouldContainExactly
import io.mockk.clearAllMocks
import io.mockk.coEvery
import io.mockk.coVerify
Expand All @@ -22,7 +23,6 @@ import no.nav.helsearbeidsgiver.felles.json.toMap
import no.nav.helsearbeidsgiver.felles.rapidsrivers.model.Fail
import no.nav.helsearbeidsgiver.felles.test.rapidsrivers.firstMessage
import no.nav.helsearbeidsgiver.felles.test.rapidsrivers.sendJson
import no.nav.helsearbeidsgiver.felles.test.shouldContainAllExcludingTempKey
import no.nav.helsearbeidsgiver.inntektsmelding.altinn.MockTilgang.toMap
import no.nav.helsearbeidsgiver.utils.json.toJson
import no.nav.helsearbeidsgiver.utils.test.wrapper.genererGyldig
Expand Down Expand Up @@ -57,7 +57,7 @@ class TilgangRiverTest :

testRapid.inspektør.size shouldBeExactly 1

testRapid.firstMessage().toMap() shouldContainAllExcludingTempKey
testRapid.firstMessage().toMap() shouldContainExactly
mapOf(
Key.EVENT_NAME to innkommendeMelding.eventName.toJson(),
Key.UUID to innkommendeMelding.transaksjonId.toJson(),
Expand Down Expand Up @@ -91,7 +91,7 @@ class TilgangRiverTest :

testRapid.inspektør.size shouldBeExactly 1

testRapid.firstMessage().toMap() shouldContainAllExcludingTempKey forventetFail.tilMelding()
testRapid.firstMessage().toMap() shouldContainExactly forventetFail.tilMelding()

coVerifySequence {
mockAltinnClient.harRettighetForOrganisasjon(innkommendeMelding.fnr.verdi, innkommendeMelding.orgnr.verdi)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,14 @@ package no.nav.helsearbeidsgiver.inntektsmelding.api
import com.github.navikt.tbd_libs.rapids_and_rivers.test_support.TestRapid
import io.kotest.core.spec.style.FunSpec
import io.kotest.matchers.ints.shouldBeExactly
import io.kotest.matchers.maps.shouldContainExactly
import no.nav.helsearbeidsgiver.domene.inntektsmelding.v1.skjema.SkjemaInntektsmelding
import no.nav.helsearbeidsgiver.felles.EventName
import no.nav.helsearbeidsgiver.felles.Key
import no.nav.helsearbeidsgiver.felles.json.toJson
import no.nav.helsearbeidsgiver.felles.json.toMap
import no.nav.helsearbeidsgiver.felles.test.mock.mockSkjemaInntektsmelding
import no.nav.helsearbeidsgiver.felles.test.rapidsrivers.firstMessage
import no.nav.helsearbeidsgiver.felles.test.shouldContainAllExcludingTempKey
import no.nav.helsearbeidsgiver.inntektsmelding.api.innsending.InnsendingProducer
import no.nav.helsearbeidsgiver.utils.json.toJson
import no.nav.helsearbeidsgiver.utils.test.wrapper.genererGyldig
Expand All @@ -30,7 +30,7 @@ class InnsendingProducerTest :
producer.publish(transaksjonId, skjema, avsenderFnr)

testRapid.inspektør.size shouldBeExactly 1
testRapid.firstMessage().toMap() shouldContainAllExcludingTempKey
testRapid.firstMessage().toMap() shouldContainExactly
mapOf(
Key.EVENT_NAME to EventName.INSENDING_STARTED.toJson(),
Key.UUID to transaksjonId.toJson(),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,12 @@ package no.nav.helsearbeidsgiver.inntektsmelding.api.aktiveorgnr
import com.github.navikt.tbd_libs.rapids_and_rivers.test_support.TestRapid
import io.kotest.core.spec.style.FunSpec
import io.kotest.matchers.ints.shouldBeExactly
import io.kotest.matchers.maps.shouldContainExactly
import no.nav.helsearbeidsgiver.felles.EventName
import no.nav.helsearbeidsgiver.felles.Key
import no.nav.helsearbeidsgiver.felles.json.toJson
import no.nav.helsearbeidsgiver.felles.json.toMap
import no.nav.helsearbeidsgiver.felles.test.rapidsrivers.firstMessage
import no.nav.helsearbeidsgiver.felles.test.shouldContainAllExcludingTempKey
import no.nav.helsearbeidsgiver.utils.json.toJson
import no.nav.helsearbeidsgiver.utils.test.wrapper.genererGyldig
import no.nav.helsearbeidsgiver.utils.wrapper.Fnr
Expand All @@ -27,7 +27,7 @@ class AktiveOrgnrProducerTest :
producer.publish(transaksjonId, arbeidsgiverFnr, arbeidstagerFnr)

testRapid.inspektør.size shouldBeExactly 1
testRapid.firstMessage().toMap() shouldContainAllExcludingTempKey
testRapid.firstMessage().toMap() shouldContainExactly
mapOf(
Key.EVENT_NAME to EventName.AKTIVE_ORGNR_REQUESTED.toJson(),
Key.UUID to transaksjonId.toJson(),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,12 @@ package no.nav.helsearbeidsgiver.inntektsmelding.api.hentforespoersel
import com.github.navikt.tbd_libs.rapids_and_rivers.test_support.TestRapid
import io.kotest.core.spec.style.FunSpec
import io.kotest.matchers.ints.shouldBeExactly
import io.kotest.matchers.maps.shouldContainExactly
import no.nav.helsearbeidsgiver.felles.EventName
import no.nav.helsearbeidsgiver.felles.Key
import no.nav.helsearbeidsgiver.felles.json.toJson
import no.nav.helsearbeidsgiver.felles.json.toMap
import no.nav.helsearbeidsgiver.felles.test.rapidsrivers.firstMessage
import no.nav.helsearbeidsgiver.felles.test.shouldContainAllExcludingTempKey
import no.nav.helsearbeidsgiver.utils.json.toJson
import no.nav.helsearbeidsgiver.utils.test.wrapper.genererGyldig
import no.nav.helsearbeidsgiver.utils.wrapper.Fnr
Expand All @@ -27,7 +27,7 @@ class HentForespoerselProducerTest :
producer.publish(transaksjonId, HentForespoerselRequest(forespoerselId), avsenderFnr)

testRapid.inspektør.size shouldBeExactly 1
testRapid.firstMessage().toMap() shouldContainAllExcludingTempKey
testRapid.firstMessage().toMap() shouldContainExactly
mapOf(
Key.EVENT_NAME to EventName.TRENGER_REQUESTED.toJson(),
Key.UUID to transaksjonId.toJson(),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,12 @@ package no.nav.helsearbeidsgiver.inntektsmelding.api.hentforespoerselIdListe
import com.github.navikt.tbd_libs.rapids_and_rivers.test_support.TestRapid
import io.kotest.core.spec.style.FunSpec
import io.kotest.matchers.ints.shouldBeExactly
import io.kotest.matchers.maps.shouldContainExactly
import no.nav.helsearbeidsgiver.felles.EventName
import no.nav.helsearbeidsgiver.felles.Key
import no.nav.helsearbeidsgiver.felles.json.toJson
import no.nav.helsearbeidsgiver.felles.json.toMap
import no.nav.helsearbeidsgiver.felles.test.rapidsrivers.firstMessage
import no.nav.helsearbeidsgiver.felles.test.shouldContainAllExcludingTempKey
import no.nav.helsearbeidsgiver.utils.json.serializer.UuidSerializer
import no.nav.helsearbeidsgiver.utils.json.toJson
import java.util.UUID
Expand All @@ -25,7 +25,7 @@ class HentForespoerselIdListeProducerTest :
producer.publish(transaksjonId, HentForespoerslerRequest(vedtaksperiodeIdListe))

testRapid.inspektør.size shouldBeExactly 1
testRapid.firstMessage().toMap() shouldContainAllExcludingTempKey
testRapid.firstMessage().toMap() shouldContainExactly
mapOf(
Key.EVENT_NAME to EventName.FORESPOERSLER_REQUESTED.toJson(),
Key.UUID to transaksjonId.toJson(),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,12 @@ package no.nav.helsearbeidsgiver.inntektsmelding.api.hentselvbestemtim
import com.github.navikt.tbd_libs.rapids_and_rivers.test_support.TestRapid
import io.kotest.core.spec.style.FunSpec
import io.kotest.matchers.ints.shouldBeExactly
import io.kotest.matchers.maps.shouldContainExactly
import no.nav.helsearbeidsgiver.felles.EventName
import no.nav.helsearbeidsgiver.felles.Key
import no.nav.helsearbeidsgiver.felles.json.toJson
import no.nav.helsearbeidsgiver.felles.json.toMap
import no.nav.helsearbeidsgiver.felles.test.rapidsrivers.firstMessage
import no.nav.helsearbeidsgiver.felles.test.shouldContainAllExcludingTempKey
import no.nav.helsearbeidsgiver.utils.json.toJson
import java.util.UUID

Expand All @@ -25,7 +25,7 @@ class HentSelvbestemtImProducerTest :
producer.publish(transaksjonId, selvbestemtId)

testRapid.inspektør.size shouldBeExactly 1
testRapid.firstMessage().toMap() shouldContainAllExcludingTempKey
testRapid.firstMessage().toMap() shouldContainExactly
mapOf(
Key.EVENT_NAME to EventName.SELVBESTEMT_IM_REQUESTED.toJson(),
Key.UUID to transaksjonId.toJson(),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,12 @@ package no.nav.helsearbeidsgiver.inntektsmelding.api.inntekt

import com.github.navikt.tbd_libs.rapids_and_rivers.test_support.TestRapid
import io.kotest.core.spec.style.FunSpec
import io.kotest.matchers.maps.shouldContainExactly
import no.nav.helsearbeidsgiver.felles.EventName
import no.nav.helsearbeidsgiver.felles.Key
import no.nav.helsearbeidsgiver.felles.json.toJson
import no.nav.helsearbeidsgiver.felles.json.toMap
import no.nav.helsearbeidsgiver.felles.test.rapidsrivers.firstMessage
import no.nav.helsearbeidsgiver.felles.test.shouldContainAllExcludingTempKey
import no.nav.helsearbeidsgiver.utils.json.toJson
import no.nav.helsearbeidsgiver.utils.test.date.januar
import java.util.UUID
Expand All @@ -25,7 +25,7 @@ class InntektProducerTest :

val publisert = testRapid.firstMessage().toMap()

publisert shouldContainAllExcludingTempKey
publisert shouldContainExactly
mapOf(
Key.EVENT_NAME to EventName.INNTEKT_REQUESTED.toJson(),
Key.UUID to transaksjonId.toJson(),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,12 @@ package no.nav.helsearbeidsgiver.inntektsmelding.api.inntektselvbestemt
import com.github.navikt.tbd_libs.rapids_and_rivers.test_support.TestRapid
import io.kotest.core.spec.style.FunSpec
import io.kotest.matchers.ints.shouldBeExactly
import io.kotest.matchers.maps.shouldContainExactly
import no.nav.helsearbeidsgiver.felles.EventName
import no.nav.helsearbeidsgiver.felles.Key
import no.nav.helsearbeidsgiver.felles.json.toJson
import no.nav.helsearbeidsgiver.felles.json.toMap
import no.nav.helsearbeidsgiver.felles.test.rapidsrivers.firstMessage
import no.nav.helsearbeidsgiver.felles.test.shouldContainAllExcludingTempKey
import no.nav.helsearbeidsgiver.utils.json.toJson
import no.nav.helsearbeidsgiver.utils.test.date.april
import no.nav.helsearbeidsgiver.utils.test.wrapper.genererGyldig
Expand All @@ -30,7 +30,7 @@ class InntektSelvbestemtProducerTest :
producer.publish(transaksjonId, InntektSelvbestemtRequest(sykmeldtFnr, orgnr, inntektsdato))

testRapid.inspektør.size shouldBeExactly 1
testRapid.firstMessage().toMap() shouldContainAllExcludingTempKey
testRapid.firstMessage().toMap() shouldContainExactly
mapOf(
Key.EVENT_NAME to EventName.INNTEKT_SELVBESTEMT_REQUESTED.toJson(),
Key.UUID to transaksjonId.toJson(),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,12 @@ package no.nav.helsearbeidsgiver.inntektsmelding.api.kvittering
import com.github.navikt.tbd_libs.rapids_and_rivers.test_support.TestRapid
import io.kotest.core.spec.style.FunSpec
import io.kotest.matchers.ints.shouldBeExactly
import io.kotest.matchers.maps.shouldContainExactly
import no.nav.helsearbeidsgiver.felles.EventName
import no.nav.helsearbeidsgiver.felles.Key
import no.nav.helsearbeidsgiver.felles.json.toJson
import no.nav.helsearbeidsgiver.felles.json.toMap
import no.nav.helsearbeidsgiver.felles.test.rapidsrivers.firstMessage
import no.nav.helsearbeidsgiver.felles.test.shouldContainAllExcludingTempKey
import no.nav.helsearbeidsgiver.utils.json.toJson
import java.util.UUID

Expand All @@ -24,7 +24,7 @@ class KvitteringProducerTest :
producer.publish(transaksjonId, forespoerselId)

testRapid.inspektør.size shouldBeExactly 1
testRapid.firstMessage().toMap() shouldContainAllExcludingTempKey
testRapid.firstMessage().toMap() shouldContainExactly
mapOf(
Key.EVENT_NAME to EventName.KVITTERING_REQUESTED.toJson(),
Key.UUID to transaksjonId.toJson(),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,14 @@ package no.nav.helsearbeidsgiver.inntektsmelding.api.lagreselvbestemtim
import com.github.navikt.tbd_libs.rapids_and_rivers.test_support.TestRapid
import io.kotest.core.spec.style.FunSpec
import io.kotest.matchers.ints.shouldBeExactly
import io.kotest.matchers.maps.shouldContainExactly
import no.nav.helsearbeidsgiver.domene.inntektsmelding.v1.skjema.SkjemaInntektsmeldingSelvbestemt
import no.nav.helsearbeidsgiver.felles.EventName
import no.nav.helsearbeidsgiver.felles.Key
import no.nav.helsearbeidsgiver.felles.json.toJson
import no.nav.helsearbeidsgiver.felles.json.toMap
import no.nav.helsearbeidsgiver.felles.test.mock.mockSkjemaInntektsmeldingSelvbestemt
import no.nav.helsearbeidsgiver.felles.test.rapidsrivers.firstMessage
import no.nav.helsearbeidsgiver.felles.test.shouldContainAllExcludingTempKey
import no.nav.helsearbeidsgiver.utils.json.toJson
import no.nav.helsearbeidsgiver.utils.test.wrapper.genererGyldig
import no.nav.helsearbeidsgiver.utils.wrapper.Fnr
Expand All @@ -30,7 +30,7 @@ class LagreSelvbestemtImProducerTest :
producer.publish(transaksjonId, skjema, avsenderFnr)

testRapid.inspektør.size shouldBeExactly 1
testRapid.firstMessage().toMap() shouldContainAllExcludingTempKey
testRapid.firstMessage().toMap() shouldContainExactly
mapOf(
Key.EVENT_NAME to EventName.SELVBESTEMT_IM_MOTTATT.toJson(),
Key.UUID to transaksjonId.toJson(),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import io.kotest.core.spec.style.FunSpec
import io.kotest.data.row
import io.kotest.datatest.withData
import io.kotest.matchers.ints.shouldBeExactly
import io.kotest.matchers.maps.shouldContainExactly
import io.mockk.clearAllMocks
import io.mockk.every
import io.mockk.mockk
Expand All @@ -22,7 +23,6 @@ import no.nav.helsearbeidsgiver.felles.rapidsrivers.model.Fail
import no.nav.helsearbeidsgiver.felles.test.mock.mockEksternInntektsmelding
import no.nav.helsearbeidsgiver.felles.test.rapidsrivers.firstMessage
import no.nav.helsearbeidsgiver.felles.test.rapidsrivers.sendJson
import no.nav.helsearbeidsgiver.felles.test.shouldContainAllExcludingTempKey
import no.nav.helsearbeidsgiver.inntektsmelding.brospinn.Mock.toMap
import no.nav.helsearbeidsgiver.utils.json.toJson
import java.util.UUID
Expand All @@ -49,7 +49,7 @@ class HentEksternImRiverTest :

testRapid.inspektør.size shouldBeExactly 1

testRapid.firstMessage().toMap() shouldContainAllExcludingTempKey
testRapid.firstMessage().toMap() shouldContainExactly
mapOf(
Key.EVENT_NAME to EventName.EKSTERN_INNTEKTSMELDING_MOTTATT.toJson(),
Key.UUID to innkommendeMelding.transaksjonId.toJson(),
Expand Down Expand Up @@ -124,7 +124,7 @@ class HentEksternImRiverTest :

testRapid.inspektør.size shouldBeExactly 1

testRapid.firstMessage().toMap() shouldContainAllExcludingTempKey forventetFail.tilMelding()
testRapid.firstMessage().toMap() shouldContainExactly forventetFail.tilMelding()

verifySequence {
mockSpinnKlient.hentEksternInntektsmelding(innkommendeMelding.spinnImId)
Expand Down
Loading

0 comments on commit 2996851

Please sign in to comment.