mirror of
https://github.com/jcwimer/wrestlingApp
synced 2026-04-01 12:15:25 +00:00
Use websockets on stats page to determine which match to stat.
This commit is contained in:
@@ -49,6 +49,38 @@ class MatchBroadcastTest < ActiveSupport::TestCase
|
||||
assert_includes broadcasts_for(stream).last, dom_id(mat, :current_match)
|
||||
end
|
||||
|
||||
test "destroy_all_matches clears mats and broadcasts no matches assigned" do
|
||||
create_double_elim_tournament_single_weight_1_6(4)
|
||||
mat = @tournament.mats.create!(name: "Mat 1")
|
||||
@tournament.reset_and_fill_bout_board
|
||||
stream = stream_name_for(mat)
|
||||
|
||||
clear_streams(stream)
|
||||
@tournament.destroy_all_matches
|
||||
|
||||
assert_operator broadcasts_for(stream).size, :>, 0
|
||||
payload = broadcasts_for(stream).last
|
||||
assert_includes payload, dom_id(mat, :current_match)
|
||||
assert_includes payload, "No matches assigned to this mat."
|
||||
assert_equal [nil, nil, nil, nil], mat.reload.queue_match_ids
|
||||
end
|
||||
|
||||
test "wipe tournament matches service clears mats and broadcasts no matches assigned" do
|
||||
create_double_elim_tournament_single_weight_1_6(4)
|
||||
mat = @tournament.mats.create!(name: "Mat 1")
|
||||
@tournament.reset_and_fill_bout_board
|
||||
stream = stream_name_for(mat)
|
||||
|
||||
clear_streams(stream)
|
||||
WipeTournamentMatches.new(@tournament).setUpMatchGeneration
|
||||
|
||||
assert_operator broadcasts_for(stream).size, :>, 0
|
||||
payload = broadcasts_for(stream).last
|
||||
assert_includes payload, dom_id(mat, :current_match)
|
||||
assert_includes payload, "No matches assigned to this mat."
|
||||
assert_equal [nil, nil, nil, nil], mat.reload.queue_match_ids
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
def broadcasts_for(stream)
|
||||
|
||||
@@ -26,6 +26,21 @@ class UpMatchesBroadcastTest < ActiveSupport::TestCase
|
||||
assert_up_matches_replace_payload(broadcasts_for(stream).last)
|
||||
end
|
||||
|
||||
test "mat clear_queue broadcasts up matches board update" do
|
||||
tournament = tournaments(:one)
|
||||
mat = mats(:one)
|
||||
match = matches(:tournament_1_bout_2000)
|
||||
stream = stream_name_for(tournament)
|
||||
|
||||
mat.update!(queue1: match.id)
|
||||
clear_streams(stream)
|
||||
|
||||
mat.clear_queue!
|
||||
|
||||
assert_operator broadcasts_for(stream).size, :>, 0
|
||||
assert_up_matches_replace_payload(broadcasts_for(stream).last)
|
||||
end
|
||||
|
||||
test "match mat assignment change broadcasts up matches board update" do
|
||||
tournament = tournaments(:one)
|
||||
mat = mats(:one)
|
||||
@@ -39,6 +54,21 @@ class UpMatchesBroadcastTest < ActiveSupport::TestCase
|
||||
assert_up_matches_replace_payload(broadcasts_for(stream).last)
|
||||
end
|
||||
|
||||
test "match mat unassignment broadcasts up matches board update" do
|
||||
tournament = tournaments(:one)
|
||||
mat = mats(:one)
|
||||
match = matches(:tournament_1_bout_2001)
|
||||
stream = stream_name_for(tournament)
|
||||
|
||||
match.update!(mat_id: mat.id)
|
||||
clear_streams(stream)
|
||||
|
||||
match.update!(mat_id: nil)
|
||||
|
||||
assert_operator broadcasts_for(stream).size, :>, 0
|
||||
assert_up_matches_replace_payload(broadcasts_for(stream).last)
|
||||
end
|
||||
|
||||
test "mat update without queue slot changes does not broadcast up matches board update" do
|
||||
tournament = tournaments(:one)
|
||||
mat = mats(:one)
|
||||
|
||||
Reference in New Issue
Block a user