Skip to content

Commit

Permalink
Fix end of period worker test
Browse files Browse the repository at this point in the history
  • Loading branch information
minter committed Dec 14, 2024
1 parent 7c4c201 commit 93ede01
Show file tree
Hide file tree
Showing 2 changed files with 102 additions and 9 deletions.

Large diffs are not rendered by default.

18 changes: 9 additions & 9 deletions test/workers/rod_the_bot/end_of_period_worker_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,14 @@ class RodTheBot::EndOfPeriodWorkerTest < ActiveSupport::TestCase
def setup
Sidekiq::Worker.clear_all
@end_of_period_worker = RodTheBot::EndOfPeriodWorker.new
@game_id = "2023020339"
@game_id = "2024020477"
end

def test_perform
VCR.use_cassette("nhl_game_#{@game_id}_gamecenter_pbp_end_of_period_1", allow_playback_repeats: true) do
feed = HTTParty.get("https://api-web.nhle.com/v1/gamecenter/#{@game_id}/play-by-play")

play_id = 28
play_id = 27
play = feed["plays"].find { |play| play["eventId"].to_i == play_id.to_i }

@end_of_period_worker.perform(@game_id, play)
Expand All @@ -23,7 +23,7 @@ def test_perform
def test_format_post
VCR.use_cassette("nhl_game_#{@game_id}_gamecenter_pbp_end_of_period_1") do
feed = HTTParty.get("https://api-web.nhle.com/v1/gamecenter/#{@game_id}/play-by-play")
play_id = 28
play_id = 27
play = feed["plays"].find { |play| play["eventId"].to_i == play_id.to_i }

home = feed.fetch("homeTeam", {})
Expand All @@ -33,13 +33,13 @@ def test_format_post
expected_output = <<~POST
🛑 That's the end of the 1st Period!
Capitals - 1
Kings - 1
Golden Knights - 0
Oilers - 4
Shots on goal after the 1st Period:
Capitals: 5
Kings: 11
Golden Knights: 17
Oilers: 21
POST
assert_equal expected_output, post
end
Expand Down

0 comments on commit 93ede01

Please sign in to comment.