MCPcopy Index your code
hub / github.com/coder/coder / assertConsistencyBetweenRouteIDAndSummary

Function assertConsistencyBetweenRouteIDAndSummary

coderd/coderdtest/swaggerparser.go:284–290  ·  view source on GitHub ↗
(t *testing.T, comment SwaggerComment)

Source from the content-addressed store, hash-verified

282var nonAlphanumericRegex = regexp.MustCompile(`[^a-zA-Z0-9-]+`)
283
284func assertConsistencyBetweenRouteIDAndSummary(t *testing.T, comment SwaggerComment) {
285 exp := strings.ToLower(comment.summary)
286 exp = strings.ReplaceAll(exp, " ", "-")
287 exp = nonAlphanumericRegex.ReplaceAllString(exp, "")
288
289 assert.Equal(t, exp, comment.id, "Router ID must match summary")
290}
291
292func assertSuccessOrFailureDefined(t *testing.T, comment SwaggerComment) {
293 assert.True(t, len(comment.successes) > 0 || len(comment.failures) > 0, "At least one @Success or @Failure annotation must be defined")

Callers 1

VerifySwaggerDefinitionsFunction · 0.85

Calls 1

EqualMethod · 0.45

Tested by

no test coverage detected