Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commitec68c50

Browse files
committed
chore: update and fix UTs
Test cases related to agent matching have to be updatednow that agent name is preferred over agent id.
1 parent4f9923c commitec68c50

File tree

1 file changed

+32
-11
lines changed

1 file changed

+32
-11
lines changed

‎src/test/kotlin/com/coder/gateway/util/LinkHandlerTest.kt‎

Lines changed: 32 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -55,15 +55,24 @@ internal class LinkHandlerTest {
5555
val tests=
5656
listOf(
5757
Pair(mapOf("agent" to"agent_name"),"9a920eee-47fb-4571-9501-e4b3120c12f2"),
58-
Pair(mapOf("agent_id" to"9a920eee-47fb-4571-9501-e4b3120c12f2"),"9a920eee-47fb-4571-9501-e4b3120c12f2"),
58+
Pair(
59+
mapOf("agent_id" to"9a920eee-47fb-4571-9501-e4b3120c12f2"),
60+
"9a920eee-47fb-4571-9501-e4b3120c12f2"
61+
),
5962
Pair(mapOf("agent" to"agent_name_2"),"fb3daea4-da6b-424d-84c7-36b90574cfef"),
60-
Pair(mapOf("agent_id" to"fb3daea4-da6b-424d-84c7-36b90574cfef"),"fb3daea4-da6b-424d-84c7-36b90574cfef"),
63+
Pair(
64+
mapOf("agent_id" to"fb3daea4-da6b-424d-84c7-36b90574cfef"),
65+
"fb3daea4-da6b-424d-84c7-36b90574cfef"
66+
),
6167
Pair(mapOf("agent" to"agent_name_3"),"b0e4c54d-9ba9-4413-8512-11ca1e826a24"),
62-
Pair(mapOf("agent_id" to"b0e4c54d-9ba9-4413-8512-11ca1e826a24"),"b0e4c54d-9ba9-4413-8512-11ca1e826a24"),
63-
// Prefer agent_id.
68+
Pair(
69+
mapOf("agent_id" to"b0e4c54d-9ba9-4413-8512-11ca1e826a24"),
70+
"b0e4c54d-9ba9-4413-8512-11ca1e826a24"
71+
),
72+
// Prefer agent name.
6473
Pair(
6574
mapOf(
66-
"agent" to"agent_name",
75+
"agent" to"agent_name_3",
6776
"agent_id" to"b0e4c54d-9ba9-4413-8512-11ca1e826a24",
6877
),
6978
"b0e4c54d-9ba9-4413-8512-11ca1e826a24",
@@ -89,15 +98,19 @@ internal class LinkHandlerTest {
8998
Triple(mapOf("agent" to"ws.agent_name"),IllegalArgumentException::class,"agent named"),
9099
Triple(mapOf("agent" to"agent_name_4"),IllegalArgumentException::class,"agent named"),
91100
Triple(mapOf("agent_id" to"not-a-uuid"),IllegalArgumentException::class,"agent with ID"),
92-
Triple(mapOf("agent_id" to"ceaa7bcf-1612-45d7-b484-2e0da9349168"),IllegalArgumentException::class,"agent with ID"),
93-
// Will ignore agent if agent_id is set even if agent matches.
101+
Triple(
102+
mapOf("agent_id" to"ceaa7bcf-1612-45d7-b484-2e0da9349168"),
103+
IllegalArgumentException::class,
104+
"agent with ID"
105+
),
106+
// Will ignore agent_id if agent is set even if agent_id matches.
94107
Triple(
95108
mapOf(
96-
"agent" to"agent_name",
109+
"agent" to"unknown_agent_name",
97110
"agent_id" to"ceaa7bcf-1612-45d7-b484-2e0da9349168",
98111
),
99112
IllegalArgumentException::class,
100-
"agentwith ID",
113+
"The workspace\"ws\" does not have anagentnamed\"unknown_agent_name\"",
101114
),
102115
)
103116

@@ -142,7 +155,11 @@ internal class LinkHandlerTest {
142155
Triple(mapOf("agent" to"ws"),IllegalArgumentException::class,"agent named"),
143156
Triple(mapOf("agent" to"ws.agent_name_3"),IllegalArgumentException::class,"agent named"),
144157
Triple(mapOf("agent" to"agent_name_4"),IllegalArgumentException::class,"agent named"),
145-
Triple(mapOf("agent_id" to"ceaa7bcf-1612-45d7-b484-2e0da9349168"),IllegalArgumentException::class,"agent with ID"),
158+
Triple(
159+
mapOf("agent_id" to"ceaa7bcf-1612-45d7-b484-2e0da9349168"),
160+
IllegalArgumentException::class,
161+
"agent with ID"
162+
),
146163
)
147164

148165
tests.forEach {
@@ -166,7 +183,11 @@ internal class LinkHandlerTest {
166183
Triple(mapOf("agent" tonull),IllegalArgumentException::class,"has no agents"),
167184
Triple(mapOf("agent_id" tonull),IllegalArgumentException::class,"has no agents"),
168185
Triple(mapOf("agent" to"agent_name"),IllegalArgumentException::class,"has no agents"),
169-
Triple(mapOf("agent_id" to"9a920eee-47fb-4571-9501-e4b3120c12f2"),IllegalArgumentException::class,"has no agents"),
186+
Triple(
187+
mapOf("agent_id" to"9a920eee-47fb-4571-9501-e4b3120c12f2"),
188+
IllegalArgumentException::class,
189+
"has no agents"
190+
),
170191
)
171192

172193
tests.forEach {

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp