Sha256: 8588c80696fa72c15983e51a8644740231f7bad728c59be694290906cc21b73d

Contents?: true

Size: 1014 Bytes

Versions: 3

Compression:

Stored size: 1014 Bytes

Contents

# frozen_string_literal: true

require_relative "broadcaster_test_case"

class StimulusReflex::NothingBroadcasterTest < StimulusReflex::BroadcasterTestCase
  test "broadcasts a server message when called" do
    broadcaster = StimulusReflex::NothingBroadcaster.new(@reflex)

    expected = {
      "cableReady" => true,
      "operations" => {
        "dispatchEvent" => [
          {
            "name" => "stimulus-reflex:server-message",
            "detail" => {
              "reflexId" => "666",
              "payload" => {},
              "stimulusReflex" => {
                "some" => :data,
                "morph" => :nothing,
                "serverMessage" => {
                  "subject" => "nothing",
                  "body" => nil
                }
              }
            },
            "reflexId" => "666"
          }
        ]
      }
    }

    assert_broadcast_on @reflex.stream_name, expected do
      broadcaster.broadcast nil, {:some => :data, "reflexId" => "666"}
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
stimulus_reflex-3.5.0.pre2 test/broadcasters/nothing_broadcaster_test.rb
stimulus_reflex-3.5.0.pre1 test/broadcasters/nothing_broadcaster_test.rb
stimulus_reflex-3.5.0.pre0 test/broadcasters/nothing_broadcaster_test.rb