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:
@@ -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)
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user