Accetta undo punteggio dalla regia sull'overlay iOS.

applyRemote ignorava aggiornamenti Action Cable con progressKey più basso, quindi il meno in regia non aggiornava il tabellone sullo stream.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
Emiliano Frascaro
2026-06-20 16:28:36 +02:00
parent 793cfaaaf1
commit e20c2ae619
4 changed files with 454 additions and 416 deletions

View File

@@ -120,4 +120,42 @@ final class ScoreControllerTests: XCTestCase {
XCTAssertEqual(controller.score.periodLabel, "Q2")
XCTAssertEqual(controller.score.period, 2)
}
func testCableUndoFromRegiaAppliesLowerScore() {
let controller = ScoreController(
scoreRepository: ScoreRepository(api: MatchLiveAPI()),
sessionCable: SessionCableService()
)
var local = ScoreState(boardType: "basket", period: 2, periodLabel: "Q2")
local.homePoints = 6
local.awayPoints = 4
controller.bind(sessionId: "session-1", initial: local)
var remote = ScoreState(boardType: "basket", period: 2, periodLabel: "Q2")
remote.homePoints = 5
remote.awayPoints = 4
controller.applyRemote(remote, source: .cable)
XCTAssertEqual(controller.score.homePoints, 5)
XCTAssertEqual(controller.score.awayPoints, 4)
}
func testPollingUndoFromRegiaAppliesWhenNotSuppressing() {
let controller = ScoreController(
scoreRepository: ScoreRepository(api: MatchLiveAPI()),
sessionCable: SessionCableService()
)
var local = ScoreState(boardType: "basket")
local.homePoints = 6
local.awayPoints = 4
controller.bind(sessionId: "session-1", initial: local)
var remote = ScoreState(boardType: "basket")
remote.homePoints = 5
remote.awayPoints = 3
controller.applyRemote(remote, source: .polling)
XCTAssertEqual(controller.score.homePoints, 5)
XCTAssertEqual(controller.score.awayPoints, 3)
}
}