Skip to content

Commit 3a0299e

Browse files
committed
Fix linter
1 parent 7f19116 commit 3a0299e

File tree

1 file changed

+83
-70
lines changed
  • jit-binding-server/src/test/kotlin/io/github/typesafegithub/workflows/jitbindingserver

1 file changed

+83
-70
lines changed

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

Lines changed: 83 additions & 70 deletions
Original file line numberDiff line numberDiff line change
@@ -9,85 +9,98 @@ import io.kotest.matchers.shouldBe
99
import io.ktor.http.Parameters
1010
import io.ktor.http.ParametersBuilder
1111

12-
class ActionCoordsTest : FunSpec(
13-
{
14-
test("extractActionCoords parses owner/name with version and no path, FULL by default") {
15-
val parameters = createParameters(owner = "o", name = "act", version = "v1")
12+
class ActionCoordsTest :
13+
FunSpec(
14+
{
15+
test("extractActionCoords parses owner/name with version and no path, FULL by default") {
16+
val parameters = createParameters(owner = "o", name = "act", version = "v1")
1617

17-
parameters.extractActionCoords(true) shouldBe ActionCoords(
18-
owner = "o",
19-
name = "act",
20-
version = "v1",
21-
significantVersion = FULL,
22-
path = null
23-
)
24-
}
18+
parameters.extractActionCoords(true) shouldBe
19+
ActionCoords(
20+
owner = "o",
21+
name = "act",
22+
version = "v1",
23+
significantVersion = FULL,
24+
path = null,
25+
)
26+
}
2527

26-
test("extractActionCoords parses owner/name with path and significant version suffix") {
27-
val parameters = createParameters(owner = "o", name = "act__p1__p2___major", version = "v9")
28+
test("extractActionCoords parses owner/name with path and significant version suffix") {
29+
val parameters = createParameters(owner = "o", name = "act__p1__p2___major", version = "v9")
2830

29-
parameters.extractActionCoords(true) shouldBe ActionCoords(
30-
owner = "o",
31-
name = "act",
32-
version = "v9",
33-
significantVersion = MAJOR,
34-
path = "p1/p2",
35-
)
36-
}
31+
parameters.extractActionCoords(true) shouldBe
32+
ActionCoords(
33+
owner = "o",
34+
name = "act",
35+
version = "v9",
36+
significantVersion = MAJOR,
37+
path = "p1/p2",
38+
)
39+
}
3740

38-
test("when extractVersion=false, version field is set to 'irrelevant'") {
39-
val parameters = createParameters(owner = "o", name = "act___minor")
41+
test("when extractVersion=false, version field is set to 'irrelevant'") {
42+
val parameters = createParameters(owner = "o", name = "act___minor")
4043

41-
parameters.extractActionCoords(false) shouldBe ActionCoords(
42-
owner = "o",
43-
name = "act",
44-
version = "irrelevant",
45-
significantVersion = MINOR,
46-
path = null,
47-
)
48-
}
44+
parameters.extractActionCoords(false) shouldBe
45+
ActionCoords(
46+
owner = "o",
47+
name = "act",
48+
version = "irrelevant",
49+
significantVersion = MINOR,
50+
path = null,
51+
)
52+
}
4953

50-
test("unknown significant version part falls back to FULL") {
51-
val parameters = createParameters(owner = "o", name = "act___weird")
54+
test("unknown significant version part falls back to FULL") {
55+
val parameters = createParameters(owner = "o", name = "act___weird")
5256

53-
parameters.extractActionCoords(false) shouldBe ActionCoords(
54-
owner = "o",
55-
name = "act",
56-
version = "irrelevant",
57-
significantVersion = FULL,
58-
path = null,
59-
)
60-
}
57+
parameters.extractActionCoords(false) shouldBe
58+
ActionCoords(
59+
owner = "o",
60+
name = "act",
61+
version = "irrelevant",
62+
significantVersion = FULL,
63+
path = null,
64+
)
65+
}
6166

62-
test("handles name with underscores/hyphens and path segments") {
63-
val parameters = createParameters(owner = "o", name = "my_action-name__dir_one__dir-two___minor", version = "v2")
67+
test("handles name with underscores/hyphens and path segments") {
68+
val parameters =
69+
createParameters(owner = "o", name = "my_action-name__dir_one__dir-two___minor", version = "v2")
6470

65-
parameters.extractActionCoords(true) shouldBe ActionCoords(
66-
owner = "o",
67-
name = "my_action-name",
68-
version = "v2",
69-
significantVersion = MINOR,
70-
path = "dir_one/dir-two",
71-
)
72-
}
71+
parameters.extractActionCoords(true) shouldBe
72+
ActionCoords(
73+
owner = "o",
74+
name = "my_action-name",
75+
version = "v2",
76+
significantVersion = MINOR,
77+
path = "dir_one/dir-two",
78+
)
79+
}
7380

74-
test("empty path part yields no path") {
75-
val parameters = createParameters(owner = "o", name = "act__\u200B___major", version = "v3") // zero-width space as noise
81+
test("empty path part yields no path") {
82+
val parameters = createParameters(owner = "o", name = "act__\u200B___major", version = "v3") // zero-width space as noise
7683

77-
parameters.extractActionCoords(true) shouldBe ActionCoords(
78-
owner = "o",
79-
name = "act",
80-
version = "v3",
81-
significantVersion = MAJOR,
82-
path = null,
83-
)
84-
}
85-
},
86-
)
84+
parameters.extractActionCoords(true) shouldBe
85+
ActionCoords(
86+
owner = "o",
87+
name = "act",
88+
version = "v3",
89+
significantVersion = MAJOR,
90+
path = null,
91+
)
92+
}
93+
},
94+
)
8795

88-
private fun createParameters(owner: String, name: String, version: String? = null): Parameters =
89-
ParametersBuilder().apply {
90-
append("owner", owner)
91-
append("name", name)
92-
version?.let { append("version", it) }
93-
}.build()
96+
private fun createParameters(
97+
owner: String,
98+
name: String,
99+
version: String? = null,
100+
): Parameters =
101+
ParametersBuilder()
102+
.apply {
103+
append("owner", owner)
104+
append("name", name)
105+
version?.let { append("version", it) }
106+
}.build()

0 commit comments

Comments
 (0)