Skip to content

Commit 4946238

Browse files
committed
Fix tests
1 parent 1abad07 commit 4946238

File tree

2 files changed

+11
-10
lines changed

2 files changed

+11
-10
lines changed

jit-binding-server/src/test/kotlin/io/github/typesafegithub/workflows/jitbindingserver/ArtifactRoutesTest.kt

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ import io.github.typesafegithub.workflows.mavenbinding.TextArtifact
66
import io.github.typesafegithub.workflows.mavenbinding.VersionArtifacts
77
import io.kotest.core.spec.style.FunSpec
88
import io.kotest.matchers.shouldBe
9+
import io.ktor.client.HttpClient
910
import io.ktor.client.request.get
1011
import io.ktor.client.statement.bodyAsText
1112
import io.ktor.http.HttpStatusCode
@@ -22,7 +23,7 @@ class ArtifactRoutesTest :
2223
// Given
2324
application {
2425
appModule(
25-
buildVersionArtifacts = {
26+
buildVersionArtifacts = { _, _ ->
2627
VersionArtifacts(
2728
files = mapOf("some-action-v4.pom" to TextArtifact { "Some POM contents" }),
2829
typingActualSource = TypingActualSource.TYPING_CATALOG,
@@ -48,7 +49,7 @@ class ArtifactRoutesTest :
4849
// Given
4950
application {
5051
appModule(
51-
buildVersionArtifacts = { null },
52+
buildVersionArtifacts = { _, _ -> null },
5253
// Irrelevant for these tests.
5354
buildPackageArtifacts = { _, _, _ -> emptyMap() },
5455
getGithubAuthToken = { "" },
@@ -68,7 +69,7 @@ class ArtifactRoutesTest :
6869
// Given
6970
application {
7071
appModule(
71-
buildVersionArtifacts = { error("An internal error occurred!") },
72+
buildVersionArtifacts = { _, _ -> error("An internal error occurred!") },
7273
// Irrelevant for these tests.
7374
buildPackageArtifacts = { _, _, _ -> emptyMap() },
7475
getGithubAuthToken = { "" },
@@ -86,8 +87,8 @@ class ArtifactRoutesTest :
8687
test("when binding generation fails and then succeeds, and two requests are made") {
8788
testApplication {
8889
// Given
89-
val mockBuildVersionArtifacts = mockk<(ActionCoords) -> VersionArtifacts?>()
90-
every { mockBuildVersionArtifacts(any()) } throws
90+
val mockBuildVersionArtifacts = mockk<(ActionCoords, HttpClient) -> VersionArtifacts?>()
91+
every { mockBuildVersionArtifacts(any(), any()) } throws
9192
Exception("An internal error occurred!") andThen
9293
VersionArtifacts(
9394
files = mapOf("some-action-v4.pom" to TextArtifact { "Some POM contents" }),
@@ -112,7 +113,7 @@ class ArtifactRoutesTest :
112113
// Then
113114
response2.status shouldBe HttpStatusCode.OK
114115

115-
verify(exactly = 2) { mockBuildVersionArtifacts(any()) }
116+
verify(exactly = 2) { mockBuildVersionArtifacts(any(), any()) }
116117
}
117118
}
118119
}

jit-binding-server/src/test/kotlin/io/github/typesafegithub/workflows/jitbindingserver/MetadataRoutesTest.kt

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ class MetadataRoutesTest :
2525
},
2626
getGithubAuthToken = { "some-token" },
2727
// Irrelevant for these tests.
28-
buildVersionArtifacts = {
28+
buildVersionArtifacts = { _, _ ->
2929
VersionArtifacts(
3030
files = emptyMap(),
3131
typingActualSource = null,
@@ -53,7 +53,7 @@ class MetadataRoutesTest :
5353
},
5454
getGithubAuthToken = { "some-token" },
5555
// Irrelevant for these tests.
56-
buildVersionArtifacts = {
56+
buildVersionArtifacts = { _, _ ->
5757
VersionArtifacts(
5858
files = emptyMap(),
5959
typingActualSource = null,
@@ -80,7 +80,7 @@ class MetadataRoutesTest :
8080
},
8181
getGithubAuthToken = { "some-token" },
8282
// Irrelevant for these tests.
83-
buildVersionArtifacts = {
83+
buildVersionArtifacts = { _, _ ->
8484
VersionArtifacts(
8585
files = emptyMap(),
8686
typingActualSource = null,
@@ -116,7 +116,7 @@ class MetadataRoutesTest :
116116
buildPackageArtifacts = mockBuildPackageArtifacts,
117117
getGithubAuthToken = { "some-token" },
118118
// Irrelevant for these tests.
119-
buildVersionArtifacts = {
119+
buildVersionArtifacts = { _, _ ->
120120
VersionArtifacts(
121121
files = emptyMap(),
122122
typingActualSource = null,

0 commit comments

Comments
 (0)