f166ff30fe
CI / changes (pull_request) Successful in 2s
CI / unit (pull_request) Successful in 8s
CI / integration (pull_request) Successful in 12s
CI / ui (pull_request) Successful in 34s
CI / gate (pull_request) Successful in 0s
CI / deploy (pull_request) Successful in 1m20s
The Telegram 'your turn' notification now names the opponent and recaps their last
move (voiced as the opponent: «{name}: my move — «WORD». Score 120:95» for a scoring
play; a short 'swapped / passed, your turn' otherwise), and a new game-over
notification reports the result + final score when a game ends by any path (closing
play, all-pass, resign, timeout). Scores are recipient-first (the reader's score
leads), 2-4 players (120:95:80).
- schema: YourTurnEvent gains opponent_name/last_action/last_word/score_line
(appended, backward-compatible); new GameOverEvent{result, score_line}. Go + UI
bindings regenerated (flatc 23.5.26 + pnpm codegen).
- backend: notify.YourTurn enriched + notify.GameOver; emitMove resolves the mover's
name and emits per-recipient (your_turn to the next mover, game_over to every seat),
with recipient-first score lines built in one place.
- gateway: game_over joins the out-of-app whitelist (routing.go).
- connector: render builds the enriched your_turn + game_over text per language (en/ru).
- tests: notify round-trip (enriched + game_over), emit (enriched fields + game_over to
all seats / per-seat result), connector render (en/ru), routing; integration replay
(play → your_turn with real name; resign → game_over) green.
- docs: ARCHITECTURE push catalog + out-of-app set, FUNCTIONAL (+ _ru), PLAN tracker.
39 lines
1.0 KiB
Go
39 lines
1.0 KiB
Go
package connector
|
|
|
|
import "testing"
|
|
|
|
func TestOutOfAppKind(t *testing.T) {
|
|
out := []string{"your_turn", "game_over", "nudge", "match_found", "notify"}
|
|
for _, k := range out {
|
|
if !OutOfAppKind(k) {
|
|
t.Errorf("OutOfAppKind(%q) = false, want true", k)
|
|
}
|
|
}
|
|
for _, k := range []string{"opponent_moved", "chat_message", "", "unknown"} {
|
|
if OutOfAppKind(k) {
|
|
t.Errorf("OutOfAppKind(%q) = true, want false", k)
|
|
}
|
|
}
|
|
}
|
|
|
|
func TestDeliverToTarget(t *testing.T) {
|
|
cases := []struct {
|
|
name string
|
|
externalID string
|
|
inAppOnly bool
|
|
want bool
|
|
}{
|
|
{"telegram + opted in", "12345", false, true},
|
|
{"in-app only suppresses", "12345", true, false},
|
|
{"no telegram identity", "", false, false},
|
|
{"no identity and in-app only", "", true, false},
|
|
}
|
|
for _, tc := range cases {
|
|
t.Run(tc.name, func(t *testing.T) {
|
|
if got := DeliverToTarget(tc.externalID, tc.inAppOnly); got != tc.want {
|
|
t.Errorf("DeliverToTarget(%q, %v) = %v, want %v", tc.externalID, tc.inAppOnly, got, tc.want)
|
|
}
|
|
})
|
|
}
|
|
}
|