feat: game lobby service

This commit is contained in:
Ilia Denisov
2026-04-25 23:20:55 +02:00
committed by GitHub
parent 32dc29359a
commit 48b0056b49
336 changed files with 57074 additions and 1418 deletions
+62
View File
@@ -159,6 +159,23 @@ func TestConstructorsBuildExpectedIntentValues(t *testing.T) {
recipientUserIDs: []string{"applicant-1"},
payloadJSON: `{"game_id":"game-1","game_name":"Nebula Clash"}`,
},
{
name: "lobby membership blocked",
build: func() (Intent, error) {
return NewLobbyMembershipBlockedIntent(metadata, "owner-1", LobbyMembershipBlockedPayload{
GameID: "game-1",
GameName: "Nebula Clash",
MembershipUserID: "user-2",
MembershipUserName: "player-aabbccdd",
Reason: "permanent_blocked",
})
},
notificationType: NotificationTypeLobbyMembershipBlocked,
producer: ProducerGameLobby,
audienceKind: AudienceKindUser,
recipientUserIDs: []string{"owner-1"},
payloadJSON: `{"game_id":"game-1","game_name":"Nebula Clash","membership_user_id":"user-2","membership_user_name":"player-aabbccdd","reason":"permanent_blocked"}`,
},
{
name: "lobby invite created",
build: func() (Intent, error) {
@@ -207,6 +224,51 @@ func TestConstructorsBuildExpectedIntentValues(t *testing.T) {
recipientUserIDs: []string{"owner-1"},
payloadJSON: `{"game_id":"game-1","game_name":"Nebula Clash","invitee_user_id":"invitee-1","invitee_name":"Nova Pilot"}`,
},
{
name: "lobby race name registration eligible",
build: func() (Intent, error) {
return NewLobbyRaceNameRegistrationEligibleIntent(metadata, "user-7", LobbyRaceNameRegistrationEligiblePayload{
GameID: "game-1",
GameName: "Nebula Clash",
RaceName: "Skylancer",
EligibleUntilMs: 1775208100000,
})
},
notificationType: NotificationTypeLobbyRaceNameRegistrationEligible,
producer: ProducerGameLobby,
audienceKind: AudienceKindUser,
recipientUserIDs: []string{"user-7"},
payloadJSON: `{"game_id":"game-1","game_name":"Nebula Clash","race_name":"Skylancer","eligible_until_ms":1775208100000}`,
},
{
name: "lobby race name registered",
build: func() (Intent, error) {
return NewLobbyRaceNameRegisteredIntent(metadata, "user-8", LobbyRaceNameRegisteredPayload{
RaceName: "Skylancer",
})
},
notificationType: NotificationTypeLobbyRaceNameRegistered,
producer: ProducerGameLobby,
audienceKind: AudienceKindUser,
recipientUserIDs: []string{"user-8"},
payloadJSON: `{"race_name":"Skylancer"}`,
},
{
name: "lobby race name registration denied",
build: func() (Intent, error) {
return NewLobbyRaceNameRegistrationDeniedIntent(metadata, "user-9", LobbyRaceNameRegistrationDeniedPayload{
GameID: "game-1",
GameName: "Nebula Clash",
RaceName: "Skylancer",
Reason: "capability_not_met",
})
},
notificationType: NotificationTypeLobbyRaceNameRegistrationDenied,
producer: ProducerGameLobby,
audienceKind: AudienceKindUser,
recipientUserIDs: []string{"user-9"},
payloadJSON: `{"game_id":"game-1","game_name":"Nebula Clash","race_name":"Skylancer","reason":"capability_not_met"}`,
},
}
for _, tt := range tests {