feat: game lobby service
This commit is contained in:
@@ -102,8 +102,8 @@ func TestInternalOpenAPISpecFreezesSharedResponseSchemas(t *testing.T) {
|
||||
wantRef: "#/components/schemas/UserLookupResponse",
|
||||
},
|
||||
{
|
||||
name: "get user by race name",
|
||||
path: "/api/v1/internal/user-lookups/by-race-name",
|
||||
name: "get user by user name",
|
||||
path: "/api/v1/internal/user-lookups/by-user-name",
|
||||
method: http.MethodPost,
|
||||
status: http.StatusOK,
|
||||
wantRef: "#/components/schemas/UserLookupResponse",
|
||||
@@ -115,6 +115,13 @@ func TestInternalOpenAPISpecFreezesSharedResponseSchemas(t *testing.T) {
|
||||
status: http.StatusOK,
|
||||
wantRef: "#/components/schemas/UserListResponse",
|
||||
},
|
||||
{
|
||||
name: "delete user",
|
||||
path: "/api/v1/internal/users/{user_id}/delete",
|
||||
method: http.MethodPost,
|
||||
status: http.StatusOK,
|
||||
wantRef: "#/components/schemas/DeleteUserResponse",
|
||||
},
|
||||
}
|
||||
|
||||
for _, tt := range tests {
|
||||
@@ -128,6 +135,47 @@ func TestInternalOpenAPISpecFreezesSharedResponseSchemas(t *testing.T) {
|
||||
}
|
||||
}
|
||||
|
||||
func TestInternalOpenAPISpecFreezesDeleteUserRequest(t *testing.T) {
|
||||
t.Parallel()
|
||||
|
||||
doc := loadOpenAPISpec(t)
|
||||
operation := getOpenAPIOperation(t, doc, "/api/v1/internal/users/{user_id}/delete", http.MethodPost)
|
||||
|
||||
assertSchemaRef(t, requestSchemaRef(t, operation), "#/components/schemas/DeleteUserRequest", "delete user request schema")
|
||||
|
||||
requestSchema := componentSchemaRef(t, doc, "DeleteUserRequest")
|
||||
assertRequiredFields(t, requestSchema, "reason_code", "actor")
|
||||
assertSchemaRef(t, requestSchema.Value.Properties["actor"], "#/components/schemas/ActorRef", "delete user request actor property")
|
||||
require.Contains(t, marshalOpenAPIJSON(t, requestSchema.Value), `"additionalProperties":false`)
|
||||
|
||||
responseSchema := componentSchemaRef(t, doc, "DeleteUserResponse")
|
||||
assertRequiredFields(t, responseSchema, "user_id", "deleted_at")
|
||||
require.Contains(t, marshalOpenAPIJSON(t, responseSchema.Value), `"additionalProperties":false`)
|
||||
}
|
||||
|
||||
func TestInternalOpenAPISpecSanctionCodeEnumIncludesPermanentBlock(t *testing.T) {
|
||||
t.Parallel()
|
||||
|
||||
doc := loadOpenAPISpec(t)
|
||||
schema := componentSchemaRef(t, doc, "SanctionCode")
|
||||
|
||||
enumValues := make([]string, 0, len(schema.Value.Enum))
|
||||
for _, value := range schema.Value.Enum {
|
||||
stringValue, ok := value.(string)
|
||||
require.True(t, ok, "SanctionCode enum entry must be a string")
|
||||
enumValues = append(enumValues, stringValue)
|
||||
}
|
||||
|
||||
require.ElementsMatch(t, []string{
|
||||
"login_block",
|
||||
"private_game_create_block",
|
||||
"private_game_manage_block",
|
||||
"game_join_block",
|
||||
"profile_update_block",
|
||||
"permanent_block",
|
||||
}, enumValues)
|
||||
}
|
||||
|
||||
func TestInternalOpenAPISpecErrorEnvelopeRemainsStable(t *testing.T) {
|
||||
t.Parallel()
|
||||
|
||||
|
||||
Reference in New Issue
Block a user